Added constructors to tangible.build, more work on keyword argument parsing, added LS.tailcall.
This commit is contained in:
@@ -109,8 +109,8 @@ LuaDefine(tangible_animinit, "tan,config",
|
||||
"|get persisted: they stay the same unless you change them in"
|
||||
"|the 'animate' command."
|
||||
"|"
|
||||
"|There are five hardwired persistent variables: plane,xyz,facing,bp,model."
|
||||
"|These five variables are persistent no matter what. This function,"
|
||||
"|There are four hardwired persistent variables: plane,xyz,facing,bp."
|
||||
"|These variables are persistent no matter what. This function,"
|
||||
"|tangible.animinit, optionally allows you to create more persistent"
|
||||
"|variables. For example, let's say you have a pirate chest. You might"
|
||||
"|want to add two persistent variables in addition to the usual set:"
|
||||
@@ -302,9 +302,9 @@ LuaDefine(tangible_build, "config",
|
||||
"|The constructor is not allowed to block."
|
||||
){
|
||||
LuaArg config;
|
||||
LuaVar classname, classtab, bp, plane, xyz, facing, mt;
|
||||
LuaVar classname, classtab, bp, plane, xyz, facing, mt, func;
|
||||
LuaRet database;
|
||||
LuaDefStack LS(L, config, classname, classtab, bp, plane, xyz, facing, mt, database);
|
||||
LuaDefStack LS(L, config, classname, classtab, bp, plane, xyz, facing, mt, func, database);
|
||||
World *w = World::fetch_global_pointer(L);
|
||||
|
||||
LuaKeywordParser kp(LS, config);
|
||||
@@ -356,10 +356,13 @@ LuaDefine(tangible_build, "config",
|
||||
// Initialize the animstate of the new tangible.
|
||||
tan->anim_queue_.clear(state);
|
||||
tan->update_plane_item();
|
||||
|
||||
// TODO: call the constructor.
|
||||
|
||||
return LS.result();
|
||||
|
||||
// Call the constructor and finish.
|
||||
LS.rawget(func, classtab, "init");
|
||||
if (!LS.isfunction(func)) {
|
||||
return LS.result();
|
||||
}
|
||||
return LS.tailcall(false, func, database, config);
|
||||
}
|
||||
|
||||
LuaDefine(tangible_get, "id",
|
||||
|
||||
Reference in New Issue
Block a user