[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Query-Calling Lua from C
- From: santhosh reddy <santhoshreddy539@...>
- Date: Thu, 24 Nov 2011 10:59:08 +0530
Hi
This is Santhosh Reddy. I would like to take a help in dropping you a doubt which I have in Lua scripting.
I have a Lua program as follows
--------------------do-me.lua---------------------------
local window = fltk:Fl_Double_Window(500, 500, "Sample Window")
messageOutput = fltk:Fl_Browser(10, 40, 400, 400)
messageOutput:add("Start")
for i=1,10 do
messageOutput:add(i)
end
messageOutput:add("End")
window:show();
Fl:run();
-----------------------
Normally when I run this program I get the output.
I run in terminal as "root# murgaLua do-me.lua"
But, Now I have one C program as follows which calls the above lua program
-------------------------do-me.c------------------
#include <stdio.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
/* the Lua interpreter */
lua_State* L;
int main ( int argc, char *argv[] )
{
/* initialize Lua */
L = lua_open();
/* load various Lua libraries */
luaL_openlibs(L);
luaL_dofile(L, "do-me.lua");
/* cleanup Lua */
lua_close(L);
return 0;
}
------------------------------------
Details of running the program are given below
-----------------------------------
root@user1-ThinkCentre-M70e:/home/user1/Desktop/LuaStuff# cc -o dome do-me.c -Wall -I/usr/include/lua5.1 -llua5.1
do-me.c: In function ‘main’:
do-me.c:18:1: warning: value computed is not used
root@user1-ThinkCentre-M70e:/home/user1/Desktop/LuaStuff# ./dome
root@user1-ThinkCentre-M70e:/home/user1/Desktop/LuaStuff#
--------------------------------------
Now when I ran the program I could not get any kind of output and encountered with warning messages.
Please help me in finding a solution to this issue. Can I run this kind of programs in Lua calling from C? Specify if I need any libraries needed regarding FLTK.
Please drop me the solution to santhoshreddy539@gmail.com
Thanks in advance.
Regards
Santhosh Reddy.