Skip to content

Instantly share code, notes, and snippets.

@leegao
Created March 14, 2009 19:12
Show Gist options
  • Save leegao/79147 to your computer and use it in GitHub Desktop.
Save leegao/79147 to your computer and use it in GitHub Desktop.
description = {}
description.credits =
[[
Author: Lee Gao
License: Creative Common
Title: CS2D Enhanced Mod System
]]
conf_dir = "settings/"
core_dir = "core/"
test_dir = "test/"
--***************--
--*Load Function*--
--***************--
function load(file)
local f = {}
for word in string.gmatch(file, "%w+") do
table.insert(f, word)
end
if f[#f] == "lua" then
f = loadfile(file)
if not f then print("Failed to load "..file) else f() end
else
f = loadfile(file..".lua")
if not f then print("Failed to load "..file..".lua") else f() end
end
end
--*********************--
--*Core Initialization*--
--*********************--
function core_init()
for line in io.lines(conf_dir.."core.cfg") do
load(core_dir..line)
end
end
--*******--
--*Hooks*--
--*******--
function hook_init()
--Initialize the Core system
core_init()
--Initialize the User system
user_init()
--Initialize the Mods system
mod_init()
--Initialize the Commands system
cmd_init()
--[
for i, fn in ipairs(hooks.init) do
fn()
end
--]] - Close this comment out on a live system.
end
function hook_say(p, t)
local ret = 0
for k, v in pairs(cmd_prefix) do
if string.lower(string.sub(t, 1, #k))==k then
t = string.sub(t, #k+1)
parseCmd(v.cmd..t, v.admin, {p})
end
if ret == 0 then ret = 1 end
end
return ret
--hook_say shouldn't need a mod iteration.
end
--[
--Simulate a round of game
--Utilities
load(test_dir.."sim")
--Round
load(test_dir.."game")
--]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment