Commit Graph
65 Commits
Author SHA1 Message Date
Glenn Maynard bed349a50a push NULL -> nil 2006-11-14 04:15:32 +00:00
Steve Checkoway f0bf9264c2 static. 2006-10-17 08:14:45 +00:00
Glenn Maynard 596eb4d881 add LUA_REGISTER_NAMESPACE, for simple non-singleton bindings 2006-10-14 23:33:25 +00:00
Glenn Maynard fdd7b0accd simplify 2006-10-14 23:26:43 +00:00
Glenn Maynard 82511f9ef5 make CheckLuaObjectType protected 2006-10-12 21:23:26 +00:00
Glenn Maynard ccfa2f16dd bOptional always true 2006-10-11 23:56:00 +00:00
Glenn Maynard 4b30d3552d A bizarre C++ wart wants us to declare FromStack overloads
before the ThemeMetric templates that use them.  That's broken
and unreasonable, so change this around a bit and make FromStack
(and Push) templates.

Push() takes a bit of a trick.  Some Push overloads push the
actual value: scalars (int, float), RageColor (pushes a table).
Others--most of them--push a reference to a C++ object.  We
want the scalars to have a reference parameter type, so we
don't make extra copies of things like RageColor when we push
them.  We need to pass C++ objects by pointer (we need to
push the actual object's pointer, not a pointer to a copy).
Further, pushing a scalar is a const operation, but pushing
a reference to an object is not.

To do both with the same template, we handle objects with
this slightly odd template:

template<> void LuaHelpers::Push<T*>( lua_State *L, T *const &pObject );

The actual overload (T) is eg. "Actor*"; this fits within the
general prototype, "Push(lua_State *L, const T &object)", giving
us a const reference to a (non-const) pointer to Actor, and we're
conceptually pushing the pointer.

The net effect of this is that 1: what was before compile errors
now becomes link time errors, but 2: these specializations
don't have to be in the headers (except for new ones for
Preference and BroadcastOnChange).
2006-10-07 01:22:28 +00:00
Glenn Maynard e7250509dd declare PushObject before using it 2006-09-30 03:23:45 +00:00
Steve Checkoway 406a8dbc0d Cannot pass non-POD through ... 2006-09-30 01:18:41 +00:00
Steve Checkoway d4d5daea7c We have virtual methods, we need virtual dtors. 2006-09-30 01:12:13 +00:00
Glenn Maynard 63cb157197 simplify LuaBinding, move more code out of the template 2006-09-29 05:07:17 +00:00
Glenn Maynard c690fdcfe4 unify registration 2006-09-29 00:01:32 +00:00
Glenn Maynard 16278ba912 just push the function; one less thing to do during dispatch 2006-09-27 08:48:26 +00:00
Glenn Maynard 2961e4d9cb typedef 2006-09-27 08:47:10 +00:00
Glenn Maynard 82222280fe use lua_setfield 2006-09-27 08:46:16 +00:00
Glenn Maynard f567a0fd28 cleanup arg order 2006-09-26 08:54:54 +00:00
Glenn Maynard 12a21ce930 remove old stuff 2006-09-21 01:41:37 +00:00
Chris Danford 7f821e8cfc CString -> RString 2006-01-22 01:00:06 +00:00
Chris Danford d507f3fd28 move LuaBinding into namespace 2005-12-27 22:58:30 +00:00
Glenn Maynard 4cd71c77bd const 2005-12-22 22:08:41 +00:00
Chris Danford 65d71a4f23 expermienting with DEFINE_METHOD macro for Lua methods 2005-09-10 02:47:04 +00:00
Glenn Maynard b6d428d37c Make Lua type checks optional. They add a lot of overhead to Lua dispatches. 2005-08-25 17:51:00 +00:00
Chris Danford be35783a30 allow multiple Luna types defined in a single .cpp 2005-08-15 01:54:04 +00:00
Eric Gustafson 52a290a867 Fix compile on GCC4 #2 (Thanks to Sesse for submitting this) 2005-07-11 21:16:53 +00:00
Eric Gustafson 541410b945 Fix compile on GCC4 (Thanks to Sesse for submitting this) 2005-07-11 19:40:18 +00:00
Glenn Maynard ea6d806dad Allow associating a table with Lua-bound objects, for storing state in Lua.
Design goals are: minimal overhead (one table); minimal extra code to use
it (two lines in the header, to have a space to store a reference to the
table), same API for classes with and without a table; allow switching to
a table-bound class without derived classes having to know about it; keep
zero per-object overhead for classes that don't need it.
2005-07-04 21:43:27 +00:00
Glenn Maynard fc948e9ce9 simplify 2005-06-23 09:04:06 +00:00
Glenn Maynard c8994b27f9 cleanup 2005-06-23 09:02:04 +00:00
Glenn Maynard a76c3fa158 cleanup; remove userdataType 2005-06-23 08:58:43 +00:00
Glenn Maynard ff9e753979 cleanup 2005-06-23 08:53:04 +00:00
Glenn Maynard ccb65cc3fe cleanup (move public/private stuff together; no code changes) 2005-06-23 08:50:58 +00:00
Glenn Maynard f3a20cf729 cleanup 2005-06-23 08:49:36 +00:00
Glenn Maynard 14fd08abc1 __type -> type 2005-06-23 08:47:34 +00:00
Glenn Maynard 36794f6d5f CheckType -> CheckLuaObjectType 2005-06-23 08:46:21 +00:00
Glenn Maynard be8c5d23b5 CreateGlobalTable -> CreateMethodsTable 2005-06-23 08:44:46 +00:00
Glenn Maynard 7e20ccc36c don't point the metatable at the methods table; comment 2005-06-23 08:42:48 +00:00
Steve Checkoway 5fd18e730a Fix "too few template-parameter-lists" error. 2005-06-20 11:20:30 +00:00
Glenn Maynard 74828836cb cosmetic 2005-06-20 09:53:02 +00:00
Glenn Maynard 3c04a63c12 simplify 2005-06-20 09:42:24 +00:00
Glenn Maynard 9276c4f395 simplify 2005-06-20 09:35:06 +00:00
Glenn Maynard bde35cb47f simplify: don't template RegType separately 2005-06-20 09:28:45 +00:00
Glenn Maynard fae7e5b265 oops, wrong guy 2005-06-20 05:08:51 +00:00
Glenn Maynard 0b3c14888f cleanup, fix name 2005-06-20 05:05:55 +00:00
Glenn Maynard 9d7f835609 no need to template Luna specializations 2005-06-20 05:02:03 +00:00
Glenn Maynard 4dd73b2c81 fix comment (no new T is created) 2005-06-20 04:42:11 +00:00
Glenn Maynard 72e7a4b1e4 cleanup 2005-06-20 04:32:24 +00:00
Glenn Maynard aff28653da Rearrange Lua types. Instead of each class registering all of the functions
of its base classes, set __index in the methods table to point to the base class's
methods table.  This has a few important advantages.  First and most importantly,
types don't need access to the Luna type of their base to derive from it, so these
definitions don't have to be in the headers, and probably don't need to be
templated.  Second, you can say:

function Actor:queue_rotate()
   self:linear(0.5)
   self:rotationz( 180 )
end

OnCommand=x,100;queue_rotate

This partially worked previously, but wasn't inherited; a function defined for
Actor wouldn't work for BitmapText.

(changes that use this in a few minutes)
2005-06-20 03:54:51 +00:00
Glenn Maynard 8c121d4598 s_className -> m_sClassName 2005-06-20 00:33:07 +00:00
Glenn Maynard 6bfb3f0bad pass L to LuaHelpers::TypeError 2005-06-15 08:33:26 +00:00
Glenn Maynard c724b4ad53 dependency cleanup 2005-05-29 03:47:40 +00:00