public class LuaBuffer : Buffer
{
public string name = "";
public override void UpdateMS()
{
try
{
LuaFunction func = table.GetLuaFunction("UpdateMS");
func.BeginPCall();
func.Push(table);
func.PCall();
func.EndPCall();
}
catch (LuaException e)
{
Debug.LogError("LuaBuffer.UpdateMS " + e.Message);
return;
}
}
public override bool Init()
{
base.Init();
this.InitWithLua();
return true;
}
public void InitWithLua()
{
l = TestLuaScene.lua;
l.LuaRequire("Model.Buffer5");
int top = l.LuaGetTop();
LuaTable t = l.CheckLuaTable(top);
LuaFunction func = t.GetLuaFunction("new"); //create a new class
func.BeginPCall();
func.PCall();
this.table = l.CheckLuaTable(l.LuaGetTop()); // get the table which new create
func.EndPCall();
}
LuaState l = null;
LuaTable table = null;
}