Sfoglia il codice sorgente

Merge branch 'lolua_refactor'

legacy
touky 8 anni fa
parent
commit
ce1fa592c5
15 ha cambiato i file con 649 aggiunte e 1493 eliminazioni
  1. +28
    -0
      .vscode/c_cpp_properties.json
  2. +15
    -0
      build/Lol (vs2015).sln
  3. +10
    -0
      doc/samples/meshviewer/imgui.ini
  4. +39
    -49
      doc/samples/meshviewer/scenesetup.cpp
  5. +1
    -3
      doc/samples/meshviewer/scenesetup.h
  6. +65
    -37
      doc/tutorial/14_lol_lua.cpp
  7. +1
    -1
      doc/tutorial/14_lol_lua.lua
  8. +2
    -2
      doc/tutorial/imgui.ini
  9. +5
    -1
      src/easymesh/easymesh.h
  10. +10
    -8
      src/easymesh/easymeshlua.cpp
  11. +84
    -603
      src/easymesh/easymeshlua.h
  12. +1
    -1
      src/lolimgui.cpp
  13. +8
    -6
      src/lolua/baselua.cpp
  14. +374
    -778
      src/lolua/baselua.h
  15. +6
    -4
      src/utils.h

+ 28
- 0
.vscode/c_cpp_properties.json Vedi File

@@ -0,0 +1,28 @@
{
"configurations": [
{
"name": "Mac",
"includePath": ["/usr/include"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
},
{
"name": "Linux",
"includePath": ["/usr/include"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
},
{
"name": "Win32",
"includePath": ["c:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include", "src"],
"browse" : {
"limitSymbolsToIncludedHeaders" : true,
"databaseFilename" : ""
}
}
]
}

+ 15
- 0
build/Lol (vs2015).sln Vedi File

@@ -66,6 +66,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B629
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "15_lolimgui", "..\doc\tutorial\15_lolimgui.vcxproj", "{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "14_lol_lua", "..\doc\tutorial\14_lol_lua.vcxproj", "{31B96262-1C41-43B9-BA38-27AA385B05DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ORBIS = Debug|ORBIS
@@ -308,6 +310,18 @@ Global
{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|Win32.Build.0 = Release|Win32
{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|x64.ActiveCfg = Release|x64
{81C83B42-D00A-4FA3-9A3D-80F9D46524BF}.Release|x64.Build.0 = Release|x64
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|ORBIS.ActiveCfg = Debug|ORBIS
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|ORBIS.Build.0 = Debug|ORBIS
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|Win32.ActiveCfg = Debug|Win32
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|Win32.Build.0 = Debug|Win32
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|x64.ActiveCfg = Debug|x64
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Debug|x64.Build.0 = Debug|x64
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|ORBIS.ActiveCfg = Release|ORBIS
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|ORBIS.Build.0 = Release|ORBIS
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|Win32.ActiveCfg = Release|Win32
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|Win32.Build.0 = Release|Win32
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|x64.ActiveCfg = Release|x64
{31B96262-1C41-43B9-BA38-27AA385B05DB}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -341,5 +355,6 @@ Global
{73F1A804-1116-46C3-922A-9C0ADEB33F52} = {4C4BD478-3767-4C27-BD91-DAAFE7CD03A2}
{B6297FF2-63D0-41EE-BE13-EFF720C9B0FA} = {1AFD580B-98B8-4689-B661-38C41132C60E}
{81C83B42-D00A-4FA3-9A3D-80F9D46524BF} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04}
{31B96262-1C41-43B9-BA38-27AA385B05DB} = {E74CF679-CA2A-47E9-B1F4-3779D6AC6B04}
EndGlobalSection
EndGlobal

+ 10
- 0
doc/samples/meshviewer/imgui.ini Vedi File

@@ -0,0 +1,10 @@
[Debug]
Pos=60,60
Size=400,400
Collapsed=0

[Camera Setup]
Pos=60,60
Size=307,314
Collapsed=0


+ 39
- 49
doc/samples/meshviewer/scenesetup.cpp Vedi File

@@ -159,93 +159,83 @@ SceneSetupLuaObject::~SceneSetupLuaObject()
//-----------------------------------------------------------------------------
SceneSetupLuaObject* SceneSetupLuaObject::New(lua_State* l, int arg_nb)
{
UNUSED(l);
UNUSED(arg_nb);
LuaStack s(l);
LuaString n;
s >> n;
return new SceneSetupLuaObject(n());
auto s = LuaStack::Begin(l);
auto n = s.Get<String>();
return new SceneSetupLuaObject(n);
}

//-- Setup command ------------------------------------------------------------
int SceneSetupLuaObject::AddLight(lua_State* l)
{
LuaStack s(l);
LuaSSetupPtr o;
LuaString t;
s >> o >> t;
o->m_setup->AddLight(FindValue<LightType>(t().C()));
return 0;
auto s = LuaStack::Begin(l);
auto o = s.GetPtr<SceneSetupLuaObject>();
auto t = s.Get<String>();
o->m_setup->AddLight(FindValue<LightType>(t.C()));
return s.End();
}
int SceneSetupLuaObject::SetupScene(lua_State* l)
{
LuaStack s(l);
LuaSSetupPtr o;
s >> o;
auto s = LuaStack::Begin(l);
auto o = s.GetPtr<SceneSetupLuaObject>();
o->m_setup->SetupScene();
return 0;
return s.End();
}
//-- main funcs ---------------------------------------------------------------
int SceneSetupLuaObject::SetPosition(lua_State* l)
{
LuaStack s(l);
LuaSSetupPtr o;
LuaVec3 c;
s >> o >> c;
auto s = LuaStack::Begin(l);
auto o = s.GetPtr<SceneSetupLuaObject>();
auto c = s.Get<vec3>();
o->m_setup->SetPosition(c);
return 0;
return s.End();
}
int SceneSetupLuaObject::SetLookAt(lua_State* l)
{
LuaStack s(l);
LuaSSetupPtr o;
LuaVec3 c;
s >> o >> c;
auto s = LuaStack::Begin(l);
auto o = s.GetPtr<SceneSetupLuaObject>();
auto c = s.Get<vec3>();
o->m_setup->SetLookAt(c);
return 0;
return s.End();
}
int SceneSetupLuaObject::SetColor(lua_State* l)
{
LuaStack s(l);
LuaSSetupPtr o;
LuaColor c;
s >> o >> c;
auto s = LuaStack::Begin(l);
auto o = s.GetPtr<SceneSetupLuaObject>();
auto c = s.Get<vec4>();
o->m_setup->SetColor(c);
return 0;
return s.End();
}
int SceneSetupLuaObject::Show(lua_State* l)
{
LuaStack s(l);
LuaSSetupPtr o;
LuaDisplay e;
s >> o >> e;
auto s = LuaStack::Begin(l);
auto o = s.GetPtr<SceneSetupLuaObject>();
auto e = s.GetEnum<SceneSetup::DisplayBase>();
o->m_setup->Show(e);
return 0;
return s.End();
}
int SceneSetupLuaObject::Hide(lua_State* l)
{
LuaStack s(l);
LuaSSetupPtr o;
LuaDisplay e;
s >> o >> e;
auto s = LuaStack::Begin(l);
auto o = s.GetPtr<SceneSetupLuaObject>();
auto e = s.GetEnum<SceneSetup::DisplayBase>();
o->m_setup->Hide(e);
return 0;
return s.End();
}
int SceneSetupLuaObject::Toggle(lua_State* l)
{
LuaStack s(l);
LuaSSetupPtr o;
LuaDisplay e;
s >> o >> e;
auto s = LuaStack::Begin(l);
auto o = s.GetPtr<SceneSetupLuaObject>();
auto e = s.GetEnum<SceneSetup::DisplayBase>();
o->m_setup->Toggle(e);
return 0;
return s.End();
}

//-----------------------------------------------------------------------------
const LuaObjectLib* SceneSetupLuaObject::GetLib()
const LuaObjectLibrary* SceneSetupLuaObject::GetLib()
{
typedef SceneSetupLuaObject SSLO;
static const LuaObjectLib lib = LuaObjectLib(
static const LuaObjectLibrary lib = LuaObjectLibrary(
"SceneSetup",
//Statics
{ { nullptr, nullptr } },
@@ -264,7 +254,7 @@ const LuaObjectLib* SceneSetupLuaObject::GetLib()
},
//Variables
{ { nullptr, nullptr, nullptr } });
return &lib;
return &lib;
}

//-----------------------------------------------------------------------------
@@ -273,7 +263,7 @@ SceneSetupLuaLoader::SceneSetupLuaLoader() : LuaLoader()
{
lua_State* l = GetLuaState();

LuaObjectDef::Register<SceneSetupLuaObject>(l);
LuaObjectHelper::Register<SceneSetupLuaObject>(l);
}

//-----------------------------------------------------------------------------


+ 1
- 3
doc/samples/meshviewer/scenesetup.h Vedi File

@@ -103,12 +103,10 @@ public:
bool m_show_gizmo;
bool m_show_lights;
};
typedef Lolua::VarEnum<SceneSetup::DisplayBase> LuaDisplay;

//-----------------------------------------------------------------------------
class SceneSetupLuaObject : public LuaObject
{
typedef Lolua::VarPtr<SceneSetupLuaObject> LuaSSetupPtr;
public:
//-------------------------------------------------------------------------
SceneSetupLuaObject(String& name);
@@ -116,7 +114,7 @@ public:

//-------------------------------------------------------------------------
static SceneSetupLuaObject* New(lua_State* l, int arg_nb);
static const LuaObjectLib* GetLib();
static const LuaObjectLibrary* GetLib();

//-------------------------------------------------------------------------
public:


+ 65
- 37
doc/tutorial/14_lol_lua.cpp Vedi File

@@ -23,7 +23,6 @@ using namespace lol;
//-----------------------------------------------------------------------------
class DemoObject : public LuaObject
{
typedef Lolua::VarPtr<DemoObject> LuaDemoObjectPtr;
public:
DemoObject() : LuaObject() {}
virtual ~DemoObject() {}
@@ -37,47 +36,67 @@ public:
//-------------------------------------------------------------------------
static int AddFive(lua_State* l)
{
LuaInt32 i; i.Get(l, 1);
auto stack = LuaStack::Begin(l);
int32_t i = stack.Get<int32_t>();

i += 5;
return i.Return(l);

return (stack << i).End();
}
static int AddTenInstance(lua_State* l)
LOLUA_DECLARE_RETURN_METHOD_ARGS(AddTenInstance, GetPtr<DemoObject>(), AddTenMethod, Get<float>(), Get<int32_t>(), Get<int32_t>());
static int _AddTenInstance(lua_State* l)
{
LuaStack stack(l);
LuaDemoObjectPtr obj;
LuaFloat f;
stack >> obj >> f;
f = obj->AddTenMethod(f);
return f.Return(l);
auto stack = LuaStack::Begin(l);
DemoObject* obj = stack.GetPtr<DemoObject>();
float f = stack.Get<float>();
int32_t i = stack.Get<int32_t>();
int32_t i2 = stack.Get<int32_t>();

f = obj->AddTenMethod(f, i, i2);

return (stack << f).End();
}
float AddTenMethod(float f)

float AddTenMethod(float f, int32_t i, int32_t i2)
{
UNUSED(i, i2);
return (f + 10);
}

static int GetX(lua_State* l)
{
LuaStack stack(l);
LuaDemoObjectPtr obj;
LuaInt32 i;
stack >> obj;
auto stack = LuaStack::Begin(l);
DemoObject* obj = stack.GetPtr<DemoObject>();
auto i = stack.Get<int32_t>();
i = obj->m_x;
return stack << i;

return (stack << i).End();
}
static int SetX(lua_State* l)

LOLUA_DECLARE_VOID_METHOD_ARGS(SetX, GetPtr<DemoObject>(), SetXMethod, Get<int32_t>());
static int _SetX(lua_State* l)
{
LuaStack stack(l);
LuaDemoObjectPtr obj;
LuaInt32 i;
stack >> obj >> i;
auto stack = LuaStack::Begin(l);
DemoObject* obj = stack.GetPtr<DemoObject>();
auto i = stack.Get<int32_t>();
obj->m_x = i;
return 0;

return stack.End();
}

void SetXMethod(int32_t i)
{
m_x = i;
}


//-------------------------------------------------------------------------
static const LuaObjectLib* GetLib()
static const LuaObjectLibrary* GetLib()
{
static const LuaObjectLib lib = LuaObjectLib(
static const LuaObjectLibrary lib = LuaObjectLibrary(
"LoluaDemo",
{ { "AddFive", &DemoObject::AddFive } },
{ { "AddTenInstance", &DemoObject::AddTenInstance } },
@@ -91,9 +110,12 @@ public:
//-----------------------------------------------------------------------------
static int GlobalAddString(lua_State* l)
{
LuaString s; s.Get(l, 1);
s() += "_added";
return s.Return(l);
auto stack = LuaStack::Begin(l);
auto s = stack.Get<String>();

s += "_added";

return (stack << s).End();
}

//-----------------------------------------------------------------------------
@@ -105,7 +127,7 @@ public:
lua_State* l = GetLuaState();

//Registering demo object
LuaObjectDef::Register<DemoObject>(l);
LuaObjectHelper::Register<DemoObject>(l);

//Registering function
LuaFunction add_string(l, "GlobalAddString", &GlobalAddString);
@@ -158,27 +180,33 @@ public:
demo_loader->TestStuff();

//Grab global test values
float testvalue_num = demo_loader->GetVar<float>("testvalue_num");
int32_t testvalue_int = demo_loader->GetVar<int32_t>("testvalue_int");
uint32_t testvalue_uint = demo_loader->GetVar<uint32_t>("testvalue_uint");
String testvalue_str = demo_loader->GetVar<String>("testvalue_str");
float testvalue_num = demo_loader->Get<float>("testvalue_num");
int32_t testvalue_int = demo_loader->Get<int32_t>("testvalue_int");
uint32_t testvalue_uint = demo_loader->Get<uint32_t>("testvalue_uint");
String testvalue_str = demo_loader->Get<String>("testvalue_str");

//Grab string modified with function
String function_return = demo_loader->GetVar<String>("function_return");
String function_return = demo_loader->Get<String>("function_return");

//Grab global values modified with DemoObject
int32_t loluademo_return = demo_loader->GetVar<int32_t>("loluademo_return");
int32_t loluademo_getx = demo_loader->GetVar<int32_t>("loluademo_getx");
float loluademo_inst_return = demo_loader->GetVar<float>("loluademo_inst_return");
int32_t loluademo_return = demo_loader->Get<int32_t>("loluademo_return");
int32_t loluademo_getx = demo_loader->Get<int32_t>("loluademo_getx");
float loluademo_inst_return = demo_loader->Get<float>("loluademo_inst_return");
DemoObject* loluademo_inst = demo_loader->GetPtr<DemoObject>("loluademo_inst");

msg::info("Lua Vars: \
testvalue_num: %.2f, testvalue_int: %i, testvalue_uint: %i, testvalue_str: %s.\n",
testvalue_num, testvalue_int, testvalue_uint, testvalue_str.C());
msg::info("Lua Vars: \
function_return: %s, loluademo_return: %i, loluademo_inst_return: %.f, loluademo_getx: %i, loluademo_inst->m_x: %i.\n",
function_return: %s, loluademo_return: %i, loluademo_inst_return: %.2f, loluademo_getx: %i, loluademo_inst->m_x: %i.\n",
function_return.C(), loluademo_return, loluademo_inst_return, loluademo_getx, loluademo_inst->m_x);

#define /***/ _LOLUA_ARG_1(a00) (float)a00
#define /***/ _LOLUA_ARG_2(a00, a01) _LOLUA_ARG_1(a00), _LOLUA_ARG_1(a01)
#define /***/ _LOLUA_ARG_3(a00, a01, a02) _LOLUA_ARG_1(a00), _LOLUA_ARG_2(a01, a02)
#define /***/ _LOLUA_ARG_4(a00, a01, a02, a03) _LOLUA_ARG_1(a00), _LOLUA_ARG_3(a01, a02, a03)
msg::info("_LOLUA_ARG_1: %f, %f, %f, %f\n", _LOLUA_ARG_4(0, 1, 2, 3));

delete demo_loader;

Ticker::Shutdown();


+ 1
- 1
doc/tutorial/14_lol_lua.lua Vedi File

@@ -13,4 +13,4 @@ loluademo_return = LoluaDemo.AddFive(1);
loluademo_inst = LoluaDemo.New();
loluademo_inst:SetX(10);
loluademo_getx = loluademo_inst:GetX();
loluademo_inst_return = loluademo_inst:AddTenInstance(2.0);
loluademo_inst_return = loluademo_inst:AddTenInstance(2.5, 4, 6);

+ 2
- 2
doc/tutorial/imgui.ini Vedi File

@@ -4,12 +4,12 @@ Size=400,400
Collapsed=0

[testature]
Pos=266,15
Pos=187,98
Size=494,359
Collapsed=0

[SO FUN !!]
Pos=30,24
Pos=16,24
Size=113,99
Collapsed=0


+ 5
- 1
src/easymesh/easymesh.h Vedi File

@@ -392,7 +392,11 @@ public:
- offset : useless
*/
void AppendCog(int nbsides, float h, float d10, float d20, float d11,
float d21, float d12, float d22, float sidemul=0.f, bool offset=false);
float d21, float d12, float d22, float sidemul = 0.f, bool offset = false);
void AppendCog(int nbsides, float h, vec2 d0, vec2 d1, vec2 d2, float sidemul = 0.f, bool offset = false)
{
AppendCog(nbsides, h, d0.x, d0.y, d1.x, d1.y, d2.x, d2.y, sidemul, offset);
}

//-------------------------------------------------------------------------
//TODO : Mesh Bone operations


+ 10
- 8
src/easymesh/easymeshlua.cpp Vedi File

@@ -27,7 +27,7 @@ EasyMeshLuaLoader::EasyMeshLuaLoader() : LuaLoader()
lua_State* l = GetLuaState();

//Registering demo object
LuaObjectDef::Register<EasyMeshLuaObject>(l);
LuaObjectHelper::Register<EasyMeshLuaObject>(l);
}

//-----------------------------------------------------------------------------
@@ -81,17 +81,17 @@ EasyMeshLuaObject* EasyMeshLuaObject::New(lua_State* l, int arg_nb)
{
UNUSED(l);
UNUSED(arg_nb);
LuaStack s(l);
LuaString n("", true);
s >> n;
return new EasyMeshLuaObject(n());
LuaStack s = LuaStack::Begin(l);
String str = s.Get<String>("");
return new EasyMeshLuaObject(str);
}

//-----------------------------------------------------------------------------
const LuaObjectLib* EasyMeshLuaObject::GetLib()
const LuaObjectLibrary* EasyMeshLuaObject::GetLib()
{
typedef EasyMeshLuaObject EMLO;
static const LuaObjectLib lib = LuaObjectLib(
#define EMLO EasyMeshLuaObject

static const LuaObjectLibrary lib = LuaObjectLibrary(
"EasyMesh",
//Statics
{ { nullptr, nullptr } },
@@ -182,6 +182,8 @@ const LuaObjectLib* EasyMeshLuaObject::GetLib()
//Variables
{ { nullptr, nullptr, nullptr } });
return &lib;

#undef EMLO
}

//-----------------------------------------------------------------------------


+ 84
- 603
src/easymesh/easymeshlua.h Vedi File

@@ -18,7 +18,6 @@ namespace lol
//-----------------------------------------------------------------------------
class EasyMeshLuaObject : public LuaObject
{
typedef Lolua::VarPtr<EasyMeshLuaObject> EzMeshPtr;
EasyMesh m_instance;
public:
//-------------------------------------------------------------------------
@@ -28,610 +27,91 @@ public:

//-------------------------------------------------------------------------
static EasyMeshLuaObject* New(lua_State* l, int arg_nb);
static const LuaObjectLib* GetLib();
static const LuaObjectLibrary* GetLib();

#define EMLO GetPtr<EasyMeshLuaObject>()

//-------------------------------------------------------------------------
static int AppendCylinder(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 nsides;
LuaFloat h, d1, d2;
LuaBool dualside(false, true), smooth(false, true), close(false, true);
s >> m >> nsides >> h >> d1 >> d2 >> dualside >> smooth >> close;
m->m_instance.AppendCylinder(nsides, h, d1, d2, dualside, smooth, close);
return 0;
}
static int AppendSphere(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 ndivisions;
LuaFloat d;
s >> m >> ndivisions >> d;
m->m_instance.AppendSphere(ndivisions, d);
return 0;
}
static int AppendCapsule(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 ndivisions;
LuaFloat h, d;
s >> m >> ndivisions >> h >> d;
m->m_instance.AppendCapsule(ndivisions, h, d);
return 0;
}
static int AppendTorus(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 ndivisions;
LuaFloat d1, d2;
s >> m >> ndivisions >> d1 >> d2;
m->m_instance.AppendTorus(ndivisions, d1, d2);
return 0;
}
static int AppendBox(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaVec3 size;
LuaFloat chamf(0.f, true);
LuaBool smooth(false, true);
s >> m >> size >> chamf >> smooth;
m->m_instance.AppendBox(size, chamf, smooth);
return 0;
}
static int AppendStar(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 nbranches;
LuaFloat d1, d2;
LuaBool fade(false, true), fade2(false, true);
s >> m >> nbranches >> d1 >> d2 >> fade >> fade2;
m->m_instance.AppendStar(nbranches, d1, d2, fade, fade2);
return 0;
}
static int AppendExpandedStar(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 nbranches;
LuaFloat d1, d2, extrad(0.f, true);
s >> m >> nbranches >> d1 >> d2 >> extrad;
m->m_instance.AppendExpandedStar(nbranches, d1, d2, extrad);
return 0;
}
static int AppendDisc(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 nsides;
LuaFloat d;
LuaBool fade(false, true);
s >> m >> nsides >> d >> fade;
m->m_instance.AppendDisc(nsides, d, fade);
return 0;
}
static int AppendSimpleTriangle(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat d;
LuaBool fade(false, true);
s >> m >> d >> fade;
m->m_instance.AppendSimpleTriangle(d, fade);
return 0;
}
static int AppendSimpleQuad(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat size;
LuaBool fade(false, true);
s >> m >> size >> fade;
m->m_instance.AppendSimpleQuad(size, fade);
return 0;
}
static int AppendCog(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 nbsides;
LuaFloat h, sidemul(0.f, true);
LuaVec2 d0, d1, d2;
LuaBool offset(false, true);
s >> m >> nbsides >> h >> d0 >> d1 >> d2 >> sidemul >> offset;
m->m_instance.AppendCog(nbsides, h, d0().x, d0().y, d1().x, d1().y, d2().x, d2().y, sidemul, offset);
return 0;
}
//-------------------------------------------------------------------------
static int TranslateX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat f;
s >> m >> f;
m->m_instance.TranslateX(f);
return 0;
}
static int TranslateY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat f;
s >> m >> f;
m->m_instance.TranslateY(f);
return 0;
}
static int TranslateZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat f;
s >> m >> f;
m->m_instance.TranslateZ(f);
return 0;
}
static int Translate(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaVec3 v;
s >> m >> v;
m->m_instance.Translate(v);
return 0;
}
//-------------------------------------------------------------------------
static int RotateX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat a;
s >> m >> a;
m->m_instance.RotateX(a);
return 0;
}
static int RotateY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat a;
s >> m >> a;
m->m_instance.RotateY(a);
return 0;
}
static int RotateZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat a;
s >> m >> a;
m->m_instance.RotateZ(a);
return 0;
}
static int Rotate(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat a;
LuaVec3 v;
s >> m >> a >> v;
m->m_instance.Rotate(a, v);
return 0;
}
//-------------------------------------------------------------------------
static int ScaleX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat x;
s >> m >> x;
m->m_instance.ScaleX(x);
return 0;
}
static int ScaleY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat y;
s >> m >> y;
m->m_instance.ScaleY(y);
return 0;
}
static int ScaleZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat z;
s >> m >> z;
m->m_instance.ScaleZ(z);
return 0;
}
static int Scale(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaVec3 v;
s >> m >> v;
m->m_instance.Scale(v);
return 0;
}
//-------------------------------------------------------------------------
static int RadialJitter(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat f;
s >> m >> f;
m->m_instance.RadialJitter(f);
return 0;
}
//-------------------------------------------------------------------------
static int TaperX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat y, z, xoff(0.f, true);
LuaBool abs(true, true);
s >> m >> y >> z >> xoff >> abs;
m->m_instance.TaperX(y, z, xoff, abs);
return 0;
}
static int TaperY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat x, z, yoff(0.f, true);
LuaBool abs(true, true);
s >> m >> x >> z >> yoff >> abs;
m->m_instance.TaperY(x, z, yoff, abs);
return 0;
}
static int TaperZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat x, y, zoff(0.f, true);
LuaBool abs(true, true);
s >> m >> x >> y >> zoff >> abs;
m->m_instance.TaperZ(x, y, zoff, abs);
return 0;
}
//-------------------------------------------------------------------------
static int TwistX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.TwistX(t, toff);
return 0;
}
static int TwistY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.TwistY(t, toff);
return 0;
}
static int TwistZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.TwistZ(t, toff);
return 0;
}
//-------------------------------------------------------------------------
static int ShearX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat y, z, xoff(0.f, true);
LuaBool abs(true, true);
s >> m >> y >> z >> xoff >> abs;
m->m_instance.ShearX(y, z, xoff, abs);
return 0;
}
static int ShearY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat x, z, yoff(0.f, true);
LuaBool abs(true, true);
s >> m >> x >> z >> yoff >> abs;
m->m_instance.ShearY(x, z, yoff, abs);
return 0;
}
static int ShearZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat x, y, zoff(0.f, true);
LuaBool abs(true, true);
s >> m >> x >> y >> zoff >> abs;
m->m_instance.ShearZ(x, y, zoff, abs);
return 0;
}
//-------------------------------------------------------------------------
static int StretchX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat y, z, xoff(0.f, true);
s >> m >> y >> z >> xoff;
m->m_instance.StretchX(y, z, xoff);
return 0;
}
static int StretchY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat x, z, yoff(0.f, true);
s >> m >> x >> z >> yoff;
m->m_instance.StretchY(x, z, yoff);
return 0;
}
static int StretchZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat x, y, zoff(0.f, true);
s >> m >> x >> y >> zoff;
m->m_instance.StretchZ(x, y, zoff);
return 0;
}
//-------------------------------------------------------------------------
static int BendXY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.BendXY(t, toff);
return 0;
}
static int BendXZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.BendXZ(t, toff);
return 0;
}
static int BendYX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.BendYX(t, toff);
return 0;
}
static int BendYZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.BendYZ(t, toff);
return 0;
}
static int BendZX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.BendZX(t, toff);
return 0;
}
static int BendZY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat t, toff(0.f, true);
s >> m >> t >> toff;
m->m_instance.BendZY(t, toff);
return 0;
}
//-------------------------------------------------------------------------
static int MirrorX(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.MirrorX();
return 0;
}
static int MirrorY(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.MirrorY();
return 0;
}
static int MirrorZ(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.MirrorZ();
return 0;
}
//-------------------------------------------------------------------------
static int LoopStart(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 loopnb;
s >> m >> loopnb;
m->m_instance.LoopStart(loopnb);
return 0;
}
static int LoopEnd(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.LoopEnd();
return 0;
}
static int OpenBrace(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.OpenBrace();
return 0;
}
static int CloseBrace(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.CloseBrace();
return 0;
}
//-------------------------------------------------------------------------
static int ToggleScaleWinding(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.ToggleScaleWinding();
return 0;
}
static int ToggleQuadWeighting(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.ToggleQuadWeighting();
return 0;
}
static int TogglePostBuildNormal(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.TogglePostBuildNormal();
return 0;
}
static int ToggleVerticeNoCleanup(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.ToggleVerticeNoCleanup();
return 0;
}
//-------------------------------------------------------------------------
static int VerticesMerge(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.VerticesMerge();
return 0;
}
static int VerticesSeparate(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.VerticesSeparate();
return 0;
}
static int VerticesCleanup(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
s >> m;
m->m_instance.VerticesCleanup();
return 0;
}
//-------------------------------------------------------------------------
static int Duplicate(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaVec3 ds(vec3(1.f));
s >> m >> ds;
m->m_instance.DupAndScale(ds, true);
return 0;
}
static int Smooth(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 pass, split_per_pass, smooth_per_pass;
s >> m >> pass >> split_per_pass >> smooth_per_pass;
m->m_instance.SmoothMesh(pass, split_per_pass, smooth_per_pass);
return 0;
}
static int SplitTriangles(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaInt32 pass;
s >> m >> pass;
m->m_instance.SplitTriangles(pass);
return 0;
}
static int Chamfer(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaFloat f;
s >> m >> f;
m->m_instance.Chamfer(f);
return 0;
}
//-------------------------------------------------------------------------
static int SetCurColor(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaColor c;
s >> m >> c;
m->m_instance.SetCurColor(c);
return 0;
}
static int SetCurColorA(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaColor c;
s >> m >> c;
m->m_instance.SetCurColorA(c);
return 0;
}
static int SetCurColorB(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaColor c;
m->m_instance.SetCurColorB(c);
return 0;
}
static int SetVertColor(lua_State* l)
{
LuaStack s(l);
EzMeshPtr m;
LuaColor c;
s >> m >> c;
m->m_instance.SetVertColor(c);
return 0;
}
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendCylinder, EMLO, m_instance.AppendCylinder, Get<int32_t>(), Get<float>(), Get<float>(), Get<float>(), Get<bool>(false), Get<bool>(false), Get<bool>(false));
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendSphere, EMLO, m_instance.AppendSphere, Get<int32_t>(), Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendCapsule, EMLO, m_instance.AppendCapsule, Get<int32_t>(), Get<float>(), Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendTorus, EMLO, m_instance.AppendTorus, Get<int32_t>(), Get<float>(), Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendBox, EMLO, m_instance.AppendBox, Get<vec3>(), Get<float>(0.f), Get<bool>(false));
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendStar, EMLO, m_instance.AppendStar, Get<int32_t>(), Get<float>(), Get<float>(), Get<bool>(false), Get<bool>(false));
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendExpandedStar, EMLO, m_instance.AppendExpandedStar, Get<int32_t>(), Get<float>(), Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendDisc, EMLO, m_instance.AppendDisc, Get<int32_t>(), Get<float>(), Get<bool>(false));
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendSimpleTriangle, EMLO, m_instance.AppendSimpleTriangle, Get<float>(), Get<bool>(false));
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendSimpleQuad, EMLO, m_instance.AppendSimpleQuad, Get<float>(), Get<bool>(false));
LOLUA_DECLARE_VOID_METHOD_ARGS(AppendCog, EMLO, m_instance.AppendCog, Get<int32_t>(), Get<float>(), Get<vec2>(), Get<vec2>(), Get<vec2>(), Get<float>(0.f), Get<bool>(false));
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(TranslateX, EMLO, m_instance.TranslateX, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(TranslateY, EMLO, m_instance.TranslateY, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(TranslateZ, EMLO, m_instance.TranslateZ, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(Translate, EMLO, m_instance.Translate, Get<vec3>());
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(RotateX, EMLO, m_instance.RotateX, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(RotateY, EMLO, m_instance.RotateY, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(RotateZ, EMLO, m_instance.RotateZ, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(Rotate, EMLO, m_instance.Rotate, Get<float>(), Get<vec3>());
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(ScaleX, EMLO, m_instance.ScaleX, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(ScaleY, EMLO, m_instance.ScaleY, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(ScaleZ, EMLO, m_instance.ScaleZ, Get<float>());
LOLUA_DECLARE_VOID_METHOD_ARGS(Scale, EMLO, m_instance.Scale, Get<vec3>());
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(RadialJitter, EMLO, m_instance.RadialJitter, Get<float>());
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(TaperX, EMLO, m_instance.TaperX, Get<float>(), Get<float>(), Get<float>(0.f), Get<bool>(true));
LOLUA_DECLARE_VOID_METHOD_ARGS(TaperY, EMLO, m_instance.TaperY, Get<float>(), Get<float>(), Get<float>(0.f), Get<bool>(true));
LOLUA_DECLARE_VOID_METHOD_ARGS(TaperZ, EMLO, m_instance.TaperZ, Get<float>(), Get<float>(), Get<float>(0.f), Get<bool>(true));
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(TwistX, EMLO, m_instance.TwistX, Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(TwistY, EMLO, m_instance.TwistY, Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(TwistZ, EMLO, m_instance.TwistZ, Get<float>(), Get<float>(0.f));
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(ShearX, EMLO, m_instance.ShearX, Get<float>(), Get<float>(), Get<float>(0.f), Get<bool>(true));
LOLUA_DECLARE_VOID_METHOD_ARGS(ShearY, EMLO, m_instance.ShearY, Get<float>(), Get<float>(), Get<float>(0.f), Get<bool>(true));
LOLUA_DECLARE_VOID_METHOD_ARGS(ShearZ, EMLO, m_instance.ShearZ, Get<float>(), Get<float>(), Get<float>(0.f), Get<bool>(true));
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(StretchX, EMLO, m_instance.StretchX, Get<float>(), Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(StretchY, EMLO, m_instance.StretchY, Get<float>(), Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(StretchZ, EMLO, m_instance.StretchZ, Get<float>(), Get<float>(), Get<float>(0.f));
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(BendXY, EMLO, m_instance.BendXY, Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(BendXZ, EMLO, m_instance.BendXZ, Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(BendYX, EMLO, m_instance.BendYX, Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(BendYZ, EMLO, m_instance.BendYZ, Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(BendZX, EMLO, m_instance.BendZX, Get<float>(), Get<float>(0.f));
LOLUA_DECLARE_VOID_METHOD_ARGS(BendZY, EMLO, m_instance.BendZY, Get<float>(), Get<float>(0.f));
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_VOID(MirrorX, EMLO, m_instance.MirrorX);
LOLUA_DECLARE_VOID_METHOD_VOID(MirrorY, EMLO, m_instance.MirrorY);
LOLUA_DECLARE_VOID_METHOD_VOID(MirrorZ, EMLO, m_instance.MirrorZ);
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(LoopStart, EMLO, m_instance.LoopStart, Get<int32_t>());
LOLUA_DECLARE_VOID_METHOD_VOID(LoopEnd, EMLO, m_instance.LoopEnd);
LOLUA_DECLARE_VOID_METHOD_VOID(OpenBrace, EMLO, m_instance.OpenBrace, Get<float>());
LOLUA_DECLARE_VOID_METHOD_VOID(CloseBrace, EMLO, m_instance.CloseBrace, Get<float>());
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_VOID(ToggleScaleWinding, EMLO, m_instance.ToggleScaleWinding);
LOLUA_DECLARE_VOID_METHOD_VOID(ToggleQuadWeighting, EMLO, m_instance.ToggleQuadWeighting);
LOLUA_DECLARE_VOID_METHOD_VOID(TogglePostBuildNormal, EMLO, m_instance.TogglePostBuildNormal);
LOLUA_DECLARE_VOID_METHOD_VOID(ToggleVerticeNoCleanup, EMLO, m_instance.ToggleVerticeNoCleanup);
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_VOID(VerticesMerge, EMLO, m_instance.VerticesMerge);
LOLUA_DECLARE_VOID_METHOD_VOID(VerticesSeparate, EMLO, m_instance.VerticesSeparate);
LOLUA_DECLARE_VOID_METHOD_VOID(VerticesCleanup, EMLO, m_instance.VerticesCleanup);
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(Duplicate, EMLO, m_instance.DupAndScale, Get<vec3>(vec3(1.f)), Get<bool>(true));
LOLUA_DECLARE_VOID_METHOD_ARGS(Smooth, EMLO, m_instance.SmoothMesh, Get<int32_t>(), Get<int32_t>(), Get<int32_t>());
LOLUA_DECLARE_VOID_METHOD_ARGS(SplitTriangles, EMLO, m_instance.SplitTriangles, Get<int32_t>());
LOLUA_DECLARE_VOID_METHOD_ARGS(Chamfer, EMLO, m_instance.Chamfer, Get<float>());
//-------------------------------------------------------------------------
LOLUA_DECLARE_VOID_METHOD_ARGS(SetCurColor, EMLO, m_instance.SetCurColor, Get<vec4>());
LOLUA_DECLARE_VOID_METHOD_ARGS(SetCurColorA, EMLO, m_instance.SetCurColorA, Get<vec4>());
LOLUA_DECLARE_VOID_METHOD_ARGS(SetCurColorB, EMLO, m_instance.SetCurColorB, Get<vec4>());
LOLUA_DECLARE_VOID_METHOD_ARGS(SetVertColor, EMLO, m_instance.SetVertColor, Get<vec4>());

/*
(csgu|csgunion) { return token::T_CSGUNION; }
(csgs|CsgSub) { return token::T_CSGSUBSTRACT; }
@@ -640,6 +120,7 @@ public:
(csgx|csgxor) { return token::T_CSGXOR; }
*/

#undef EMLO
};

//-----------------------------------------------------------------------------


+ 1
- 1
src/lolimgui.cpp Vedi File

@@ -375,7 +375,7 @@ void LolImGui::RenderDrawListsMethod(ImDrawData* draw_data)
m_vdecl->SetStream(vbo, m_attribs[0], m_attribs[1], m_attribs[2]);

const ImDrawIdx* idx_buffer_offset = 0;
for (size_t cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
{
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[(int)cmd_i];
#ifdef SHOW_IMGUI_DEBUG


+ 8
- 6
src/lolua/baselua.cpp Vedi File

@@ -40,8 +40,9 @@ class LuaBaseData
int status = luaL_dostring(l, s.C());
if (status == 1)
{
LuaString error; error.Get(l, -1);
msg::error("Lua error %s\n", error().C());
auto stack = LuaStack::Begin(l, -1);
auto error = stack.Get<String>();
msg::error("Lua error %s\n", error.C());
lua_pop(l, 1);
}
return status;
@@ -53,8 +54,8 @@ class LuaBaseData
if (lua_isnoneornil(l, 1))
return LUA_ERRFILE;

LuaCharPtr var; var.Get(l, 1);
char const *filename = var;// lua_tostring(l, 1);
auto stack = LuaStack::Begin(l);
char const *filename = stack.Get<char const*>();
int status = LUA_ERRFILE;

File f;
@@ -76,8 +77,9 @@ class LuaBaseData
msg::error("could not find Lua file %s\n", filename);
else if (status == 1)
{
LuaString error; error.Get(l, -1);
msg::error("Lua error %s\n", error().C());
stack.SetIndex(-1);
auto error = stack.Get<String>();
msg::error("Lua error %s\n", error.C());
lua_pop(l, 1);
}



+ 374
- 778
src/lolua/baselua.h
File diff soppresso perché troppo grande
Vedi File


+ 6
- 4
src/utils.h Vedi File

@@ -61,6 +61,12 @@ template< class T > inline int GetRandom(array<T> src)

// Gets the value for the given enum type.
template<class T> inline T FindValue(const char* name)
{
auto str = String(name);
return FindValue<T>(str);
}

template<class T> inline T FindValue(String const& name)
{
String n = name;
n.to_lower();
@@ -72,10 +78,6 @@ template<class T> inline T FindValue(const char* name)
}
return T::Max;
}
template<class T> inline T FindValue(String const& name)
{
return FindValue<T>(name.C());
}

} /* namespace lol */


Caricamento…
Annulla
Salva