does lua work in linux ?

Miscellaneous Forums/Linux Discussion/does lua work in linux ?

I was just mucking around using lua on my windows machine then I decided to carry on using the linux box when when I compile it fails with a dialog saying

"cannot find interface for module axe.lua"

this is the code Im trying to compile.

SuperStrict

Import axe.lua

Global finished:Int

finished = False

Local LuaState:Byte Ptr = luaL_newstate()
luaL_openlibs(LuaState)

Local Script:String

RunScript(LuaState,"print('8'+8)")
RunScript(LuaState,"print('Hello World!','**')")
RunScript(LuaState,"print('Hello World End!')")

RunScript(LuaState,"print('Done')")

Print "----------OutPut----------"
Print GetPrintOut(LuaState)
Print "--------------------------"

lua_close(LuaState)

Print "finished"
End

Function RedirectPrint(LuaState:Byte Ptr)
	' Initialise the PrintOut Global variable
	lua_pushstring(LuaState, "")
	lua_setglobal (LuaState, "PrintOut") 

	' Replace the print function with our one which will
	' add the output to the Global variable
	RunScript(LuaState, ..
		"function print(...)~r~n" ..
		+" if arg.n > 0 then~r~n" ..
		+"   for indx = 1, arg.n do~r~n" ..
		+"     if PrintOut == '' then~r~n" ..
		+"       PrintOut = arg[indx]~r~n" ..
		+"     else~r~n" ..
		+"       if indx == 1 then~r~n" ..
		+"         PrintOut = string.format('%s\r\n%s',PrintOut,arg[indx])~r~n" ..
		+"       else~r~n" ..
		+"         PrintOut = string.format('%s %s',PrintOut,arg[indx])~r~n" ..
		+"       end~r~n" ..
		+"     end~r~n" ..
		+"   end~r~n" ..
		+" end~r~n"..
		+"end")	
End Function

Function RunScript:Int(LuaState:Byte Ptr,script:String)
	Local res:Int
	res = luaL_loadString(LuaState,script)
'	Print "loading"
'	Print Script
'	Print "-------------"
'	Print "load returned : " + res
	If res <> 0 Then
		Print "ERROR : " + luaL_CheckString(LuaState,-1)
	Else
		res = lua_pcall(LuaState,0,LUA_MULTRET,0)
		If res <> 0 Then
			Print "ERROR : " + luaL_CheckString(LuaState,-1)
		End If
	End If
End Function

Function GetPrintOut:String(LuaState:Byte Ptr)
	Local retStr:String
	' get the Global variable containing all the print output
	' since the last time it was retrieved.
	lua_getGlobal(LuaState,"PrintOut")
	retStr = lua_toString(LuaState,-1)
	' Clear out the Global variable
	lua_pushstring(LuaState, "")
	lua_setglobal (LuaState, "PrintOut")
	
	Return retStr 
End Function


any ideas ?

is there a folder called axe.mod in your mods folder?

this is the result of me compiling:
Building untitled1
Compiling:untitled1.bmx
flat assembler  version 1.64
3 passes, 5563 bytes.
Linking:untitled1
Executing:untitled1
16
Hello World!	**
Hello World End!
Done
----------OutPut----------

--------------------------
finished
/home/Perty/Programming/Blitzmax/mod/axe.mod/lua.mod/lua.release.linux.x86.a(loslib.c.release.linux.x86.o): In function `os_tmpname':
loslib.c:(.text+0x2f): warning: the use of `tmpnam' is dangerous, better use `mkstemp'

Process complete


duh !,

OK.. there is no axe.mod folder. Stupid me for not checking.
I did a full synch last night and Im sure I checked the axe checkbox.

I dont have internet at the moment so Ill try to re-synch tonight and actually check it this time :)

sorry for wasting your time on that.

axe.lua is not on the 1.28
you can only get it by manually syncing it from the 1.24 syncmod server

cheers.. Now I actually have the axe.lua module it works.

anyway... after my stupidity Ill try and follow it up with a half decent question.

does anyone know what that warning message means when you run it ?

I never got rid of the warning I always get about libstdc++.so.6 needs by libGLU.. may conflict with libstdc++.so.4.

Now I get this new warning too.. Should I worry about it ?
Perturbatio's output shows it in case your wondering what the warning message is.

the error message in my output is about loslib.c using a dangerous function, what's the libstdc error?

the warning I get is :

/usr/bin/ld: warning: libstdc++.so.6, needed by /usr/lib/libGLU.so, may conflict with libstdc++.so.5

well... that doesn't seem to cause a problem for this guy

yeah... Ive always had that particular warning I just find it a little iritating.
Im a bit Obsessive-compulsive I guess..
Im one of those people who when coding will keep fixing the code until the compiler returns zero warnings.