alireza_sh1992

Untitled

Mar 15th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. void lua_init (const char *file) {
  2. if (!file) { return; }
  3. have_file = 1;
  4. luaState = luaL_newstate();
  5. luaL_openlibs (luaState);
  6.  
  7. int i = 0;
  8. while (functions[i].name) {
  9. my_lua_register (luaState, functions[i].name, universal_from_lua);
  10. i ++;
  11. }
  12.  
  13. lua_register (luaState, "postpone", postpone_from_lua);
  14. lua_register (luaState, "safe_quit", safe_quit_from_lua);
  15. lua_register (luaState, "register_interface_function", register_interface_from_lua);
  16.  
  17. print_start ();
  18. int r = luaL_dofile (luaState, file);
  19. print_end ();
  20.  
  21. if (r) {
  22. logprintf ("lua: %s\n", lua_tostring (luaState, -1));
  23. exit (1);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment