lua_getglobal in Lua-C communication?lua_call functionlua_register functionlua_pushcfunction()lua_register()lua_getglobal()lua_call()luaL_checknumber do when called from Lua?lua_pushcfunction in Lua-C communication?lua_pcall function differ from lua_call?lua_pcall includes error handlinglua_call calls a Lua function directlylua_pcall is used only for C functionslua_register(L, "function_name", my_function)lua_pushcfunction(L, my_function)lua_add_function(L, "my_function")lua_call(L, my_function)luaL_ref in Lua from C?| Qno | Answer |
|---|---|
| 1 | c) Scripting engine for embedding |
| 2 | b) Lightweight, fast scripting |
| 3 | b) It is lightweight and fast |
| 4 | a) Extensible syntax |
| 5 | a) Game engines |
| 6 | b) Enabling flexible and customizable user actions |
| 7 | b) Automatic garbage collection |
| 8 | b) Through the Lua C API |
| 9 | b) It allows C code to invoke Lua functions and vice versa |
| 10 | d) lua_pushcfunction() |
| 11 | b) To retrieve a global Lua variable into C |
| 12 | c) Lua’s basic types map to C types |
| 13 | b) Lua objects must be converted to C types |
| 14 | b) The error is propagated to C through a callback |
| 15 | c) Lua library linking and a Lua interpreter |
| 16 | b) It allows dynamic configuration without recompiling |
| 17 | b) By embedding Lua interpreter in the application |
| 18 | b) Use lua_register function |
| 19 | b) lua_register() |
| 20 | c) As arguments on the Lua stack |
| 21 | b) Ensures the argument is a valid number |
| 22 | c) By pushing values onto the Lua stack |
| 23 | b) It pushes a C function onto the Lua stack |
| 24 | a) Linking Lua interpreter with the C program |
| 25 | a) lua_pcall includes error handling |
| 26 | a) lua_register(L, "function_name", my_function) |
| 27 | b) By pushing the result to the Lua stack |
| 28 | b) Lua throws an error |
| 29 | b) Yes, using Lua’s C API to access tables |
| 30 | b) Stores a Lua object in a reference table |