Page 1 of 1
Create Table ----> lua
Posted: Sat Jan 08, 2011 2:31 pm
by lambor734
Hi All ,
How can create table in lua?
I want some method by it I create.
For example :
Code: Select all
s={}
function s.lua()
return 1
end
function s.pb()
return 0
end
And more ...
But I'm using the library liblua5.1.lib , And how to create them in the library I do not know.

Re: Create Table ----> lua
Posted: Sat Jan 08, 2011 3:38 pm
by lambor734
For example, how is the following function will call such methods?
Code: Select all
ProcedureC MsgBox_Lua(L.l)
If lua_type(L, 1) = #LUA_TSTRING
Protected param1.s = PeekS(luaL_checkstring(L,1))
Else
lua_myError(L,"Wrong type of parameter 1. String expected!")
EndIf
If lua_type(L, 2) = #LUA_TSTRING
Protected param2.s = PeekS(luaL_checkstring(L,2))
Else
lua_myError(L,"Wrong type of parameter 2. String expected!")
EndIf
If lua_type(L, 3) = #LUA_TNUMBER
Protected param3.l=luaL_checknumber(L,3)
Else
lua_myError(L,"Wrong type of parameter 3. Number expected!")
EndIf
lua_pushnumber(L,MessageBox_(hWndMain,param1,param2,param3))
ProcedureReturn 1
EndProcedure
lua_register(L,"MessageBox", @MsgBox_lua())
Call
Re: Create Table ----> lua
Posted: Sat Jan 08, 2011 4:08 pm
by lambor734
Please F1 .

Re: Create Table ----> lua
Posted: Sat Jan 08, 2011 4:51 pm
by Tomi
Hi lambor734, I don't knoe an answer to your question exactly, but i know you can use Dim instead Table

Re: Create Table ----> lua
Posted: Sat Jan 08, 2011 5:03 pm
by lambor734
Thank You my friend,
But if you can explain further.
Re: Create Table ----> lua
Posted: Sat Jan 08, 2011 7:32 pm
by Tomi
i no have expert in pb as good, sorry
maybe this topic can be help you:
http://www.purebasic.fr/english/viewtop ... ilit=Table
Re: Create Table ----> lua
Posted: Sat Jan 08, 2011 8:51 pm
by lambor734
Oh no, I do not want to simulate.
I want lua internal commands, the method I created.
Re: Create Table ----> lua
Posted: Sun Jan 09, 2011 10:10 am
by buddymatkona
The general use of lua is outside the scope of this forum. If you are asking how to call C-compatible functions in a library, there are examples already in the forum. Specific lua interface information can be found in .h files. All functions from the auxiliary library for example are defined in header file lauxlib.h and have a prefix luaL_.
Re: Create Table ----> lua
Posted: Sun Jan 09, 2011 10:55 am
by lambor734
Ok, but this library is designed for Pb, and discuss it's free.
However, many of my friends like cas helped.
I hope everyone in this case is about to raise.

Re: Create Table ----> lua
Posted: Sun Jan 09, 2011 12:24 pm
by Tomi
Re: Create Table ----> lua
Posted: Sun Jan 09, 2011 12:46 pm
by lambor734
Ok,thank you.
