[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: declare func with luaL_dostring and call it with second luaL_dostring?
- From: Jacob Ole Juul Kolding <dacobi@...>
- Date: Fri, 21 Sep 2012 14:56:25 +0200
Hello Lua List :)
This is my first post and I'm quite new with Lua.
I've incorporated Lua in my 3d-engine and it works nicely.
But now I'm trying to split the declaration of functions and there execution into different calls to luaL_dostring
and I can't get it to work..
if i have the following lua script file:
function f()
io.write("Hello")
end
f()
And it prints hello if I run it with luaL_dostring, but if I split it into to calls
function f()
io.write("Hello")
end
and then
f()
it tells med that global f is nil ??
How do I declare function f so that I can execute it multiple times in other calls to luaL_dostring?
Best Regards
/Jacob
--
"Believe
nothing, no matter where you read it, or who said it, no matter if I have said
it, unless it agrees with your own reason and your own common sense."
-- Buddha