lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I would like to do this in C:
>
> int *p_time;
>
> p_time = (int*)LuaGetVarAddress("time");
>
> and, for every game frame:
>
> *p_time = GetTime();


I assume that GetTime() returns a number (integer or float). Then you change
global variable "time" that way:

lua_pushnumber(L, GetTime());
lua_setglobal(L, "time");