|
Greetings,
The problem with your example is that in your c code you are calling lua_tocfunction (look at the "c" between "to" and "function"), which explicitly return a pointer to a C function as Lua likes them (that is taking a lua_State* and returning an int). funk is a pure Lua function, so lua_tocfunction returns NULL. In manual there : http://www.lua.org/manual/5.1/manual.html#lua_tocfunction
Hmm... where is that 'c' came from :). Sorry bothering but is there any similar function for pure lua functions? or how can i convert them to strings? Replacing lua_tocfunction with lua_tostring giving another null. Another... is it possible to get from global index (lua_getglobal) without running the script? (And without using lua internals) It is better if i do some goooogling isn't it? :)