LUA Форум
Search
Recent Topics
Hottest Topics
Member Listing
Back to home page
Register
/
Login
Messages posted by: Dr.Radio
Forum Index
»
Profile for Dr.Radio
»
Messages posted by Dr.Radio
Author
Message
LUA: Общие вопросы
»
Регистрация функций
»
Go to message
Спасибо!
LUA: Общие вопросы
»
Регистрация функций
»
Go to message
А вот такой код сработает?
int Init_script () { printf ("Lua: creating context: "); Game = lua_open (); if (Game == NULL) { printf ("Error: cannot create the context!\n"); } printf ("OK!\n"); luaL_openlibs (Game); lua_newtable (Game); lua_setglobal (Game, "engine"); lua_pushcfunction (Game, Load_map); lua_setfield (Game, -1, "Open"); lua_pushcfunction (Game, Quit); lua_setfield (Game, -1, "Quit"); lua_pushcfunction (Game, Reload_game); lua_setfield (Game, -1, "Game"); lua_pop (Game, 1); /*********************************************************************/ lua_newtable (Game); lua_setglobal (Game, "sound"); lua_pushcfunction (Game, Load_music); lua_setfield (Game, -1, "Music"); lua_pushcfunction (Game, Play_sound); lua_setfield (Game, -1, "Play"); lua_pushcfunction (Game, Register_sound); lua_setfield (Game, -1, "Register"); lua_pop (Game, 1); /*********************************************************************/ lua_newtable (Game); lua_setglobal (Game, "render"); lua_pushcfunction (Game, Render_scene); lua_setfield (Game, -1, "Scene"); lua_pushcfunction (Game, Print); lua_setfield (Game, -1, "Print"); lua_pushcfunction (Game, Load_font); lua_setfield (Game, -1, "Load_font"); lua_pop (Game, 1); /*********************************************************************/ lua_newtable (Game); lua_setglobal (Game, "input"); lua_pushcfunction (Game, Get_input); lua_setfield (Game, -1, "Get"); lua_pop (Game, 1); return 0; }
LUA: Общие вопросы
»
Регистрация функций
»
Go to message
А если создать таблицу и в неё вставлять функции?
LUA: Общие вопросы
»
Регистрация функций
»
Go to message
А как сделать из основной программы так, чтобы функции этой основной программы из скрипта вызывались так: "engine.foo (arg)"?
LUA: Общие вопросы
»
Стуктуры и перечисления
»
Go to message
Доброго времени суток! У меня возник следущий вопрос: как передать в скрипт структуры и перечисления?
Forum Index
»
Profile for Dr.Radio
»
Messages posted by Dr.Radio
Go to:
Select a forum
LUA: Общие вопросы
LUA: WEB
LUA: ION
Вакансии
Powered by
JForum 2.1.9
©
JForum Team