I’m studying the lua example and mod something for fun. The lua example’s tick function doesn’t contain the parameter so I add it like this.
function tick(dt)
xxxx
end
And then I try echo dt find that is a string type.
bool CCLuaScriptModule::executeSchedule(const std::string& handler_name, ccTime cc){
//blah blah blah
lua_pushfstring(d_state, “%f”, cc);
…
}
If my func depends on it. The ccTime must be convert to number type again.
So I just mod this to, everything works fine
lua_pushnumber(d_state, cc);
I don’t know why?
Anther I wanna know does the lua version have memory leak? I really want to write my commerial game in lua.