lua and c where canI find some examples?
hello I try to using lua whit c and I have some problems when I try to compile...
where can I find some examples???
desocupada
The Lua API manual.
Sorry, I couldn''t find any examples though. Maybe you''ll have better luck with Google than me.
henrym
My Site
Sorry, I couldn''t find any examples though. Maybe you''ll have better luck with Google than me.
henrym
My Site
Here''s a pretty simple example to get you started, call this luatest.c
Then create a lua file and call it test.lua
Let me know what operating system you''re using and I''ll try to help you get it compiled.
Tony
#include <stdio.h>extern "C" { #include "lua.h" #include "lualib.h"}/* the Lua interpreter */lua_State* L;int main ( int argc, char *argv[] ){ /* initialize Lua */ L = lua_open(0); /* load Lua libraries */ lua_baselibopen(L); lua_iolibopen(L); lua_mathlibopen(L); /* run a script */ lua_dofile(L, "test.lua"); /* cleanup Lua */ lua_close(L); return 0;}
Then create a lua file and call it test.lua
-- simple testprint "Hello, World!"
Let me know what operating system you''re using and I''ll try to help you get it compiled.
Tony
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement