Hello people!!!!
I need a little help!!!!
How can get form a LUA FILE a teble and put it into an array
of string in my C# class
string[] sss = xxxx["tableLua"].to String();
???
hmmm, in lua a table is almost like an array so it wouldnt change much! but then u want to convert it to a string? well, each item has it value in the array or table, so u can convert it easily just use tostring(xxx["tablelua"])
Thanck you!!!!!,,, i'm goin' to try!!!!!!!
I get the table with this object (LuaInterface.LuaTable)
LuaInterface.LuaTable AWWAW= pluto.GetTable("a");
i get my table from lua file and now it becomes a c# objet....
so....
how can i test the lenght of AWWAW????
AWWAW.lenght(); it does not work
AWWAW.size(); it does not work
how can i get the AWWAW items and put them in my array
String[] str = new String[];
for (int i = 0, to (AWWAW.lenght-1), i++)
{
str = AWWAW(i)
}
HELP ME PLEASE!!!!!!!!!!!!
Hi i'm using simulair code in my menu for robocop. So i know what ya mean or looking for, but i'm writting it in VB.Net so i can't tell ya how it should look in C#
I will ask some 1 else to help you...
Darn she got a lovely smile :D
Laterss Optimus
I'm using .net but in c# not vb...
how can i do the thinghs i'm doin with vb. dotnet????
how do you import lua DLLs?????
help me please....
if i could use vb......
i'm loosing a lot of time with c# (java)....
somebody say that's java is better......
HELP!!!!!!!!!!!!!
QuoteI'm using .net but in c# not vb...
how can i do the thinghs i'm doin with vb. dotnet????
how do you import lua DLLs?????
help me please....
if i could use vb......
i'm loosing a lot of time with c# (java)....
somebody say that's java is better......
HELP!!!!!!!!!!!!!
' Import the LUA interface
Imports LuaInterface
Imports System.IO
Public Class frmRobocop
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private LUA As LUA
Private Sub frmRobocop_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Intialize the Lua interface
LUA = New Lua
'Open LUA libraries
LUA.OpenBaseLib()
LUA.OpenDebugLib()
LUA.OpenIOLib()
LUA.OpenMathLib()
LUA.OpenStringLib()
LUA.OpenTableLib()
Try
'Dofile our needed files/tables
LUA.DoFile(Application.StartupPath + "\system\robocoplua.lua") 'Store you lua code in here that can be called for later use
LUA.DoFile(Application.StartupPath + "\settings.tbl")
LUA.DoFile(Application.StartupPath + "\tbl\scriptlevel.tbl")
''LUA.DoFile(Application.StartupPath + "\tbl\inbuildlevel.tbl")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
'Register object for use in lua
LUA("TextBox_Txt") = TextBox_Txt
'Trigger LUA event, called StartRoboCopLUA (this function is in my case stored in the file robocoplua.lua)
Try
LUA.GetFunction("StartRoboCopLUA").Call()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
This gives you an idea what can be done
- Optimus
The LUA.NET package is great..
The only thing i miss of it is iteration of tables etc..
You must know position or key to enter value in table from C#
You use LuaTable LT = LUA.GetTable("MyTable");
now you enter it with LT[Number] or LT[Key]
If you really want to iterate over a table i recomend you to register a C# Array to LUA;
Create the C# Array and register it with LUA["MyCArray"] = ArrayObject;
now, you can write code with LUA.Dostring();
Iterate the table you want and insert it to the C# Array
for i,v in MyLuaTable do
MyCArray:Add(v)
end
return 1;
Upon return 1 you are ready to access the content.
Just play around, you will figure it out somehow and eventually it will be clearer to you what i mean
Andrea ma sei la gnocca in foto? :D
Kepp that is not the right way to seduse a lady you know.
btw mate your KEY will never fit... :D
Btw: Are you really a girl andrea.vermetti
I want to now so I can keep messing with kepp. :P
LoooooL // NL
[COLOR=green]/* Open needed libraries */[/COLOR]
Lua LUA = new Lua();
LUA.OpenBaseLib();
LUA.OpenMathLib();
...
...
[COLOR=green]
/*
To register the objUser class with LUA first intialize it then
decide name for it to use in lua:
*/[/COLOR]
LUA["Sexbomb"] = objUser;
[COLOR=green]
/* The code below show you how this class can be used within LUA */[/COLOR]
Sexbomb.sPhonenumber = Sexbomb:AskPhoneNumber()
Sexbomb.sAddress = Sexbomb:AskAddress();
Sexbomb.bBiggyBoob = Sexbomb:AskBoobs();
private class objUser
{
private string mstrPhoneno = null;
private string mstrAddress = null;
private bool mboolBigbo = false;
[COLOR=green]/* Some class properties */[/COLOR]
public string sPhonenumber
{
get {return mstrPhoneno;}
set {mstrPhoneno = value;}
}
public string sAddress
{
get {return mstrAddress;}
set {mstrAddress = value;}
}
public bool bBiggyBoob
{
get {return mboolBigbo;}
set {mboolBigbo = value;}
}
[COLOR=green]/* Class function */[/COLOR]
public string AskPhonenumber()
{
Console.WriteLine("What is your phone number??");
return Console.ReadLine();
}
public string AskAddress()
{
Console.WriteLine("What is your address?");
return Console.ReadLine();
}
public bool AskBoobs()
{
Console.WriteLine("Are they big?");
return Convert.ToBoolean(Console.ReadLine());
}
}
[COLOR=green]
/*
To get tables from LUA you should use LuaTable class.
Problem is that you cannot iterate over the table elements with this class!
I just came up with a solution to this problem which will return a lua table as
an Hashtable in C#
*/
[/COLOR]
function Hashtable GetLUATable(string Tablename)
{
Hashtable tmp = new Hashtable();
LUA["Hashtable"] = tmp; [COLOR=green]// Register out temp Hashtable to LUA[/COLOR]
[COLOR=green]// Put values in table into Hashtable[/COLOR]
LUA.DoString("for i,v in " + Tablename + " do " +
"Hashtable:Add(i,v) " +
"end")
LUA["Hashtable"] = null; [COLOR=green]// Converted to nil[/COLOR]
return tmp;
}
[COLOR=green]
/* Now you have a returned Hashtable, were you can iterate over both Index and Keys.
the Hashtable is accessed from System.Collections..
I havwe not tested above function but should perform the task
*/
[/COLOR]
****
GetLUATable function shall be C# function so change to C#
Andrea molto gnocca complimenti :D
Sperando ke sia lei eh^_^
Thank you everybody!!!!!!
You resolved all my trubles!!!!!
KISSES
for italian kids.....
yes i'm pretty girl from Reggio Emilia!!!!
Hi Andrea^_^
I knew you're a pretty italian girl^_^
Post me if u want speake about ptokax and scripts ;)
Yea or me...
PM me and i'll ya anything you want to know ;)