Changes between Version 3 and Version 4 of documentation/LuaManual/PythonDifferences
- Timestamp:
- 06/09/12 06:53:39 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
documentation/LuaManual/PythonDifferences
v3 v4 17 17 [wiki:documentation/LuaManual/Colours Colourb and Colourf] in Lua have a ''rgba'' property, where Python does not. 18 18 19 Lua has no classes, and casting from one type to another is important. Casting an ''Element'' to one of its child classes is prov ed through the ''Element.As'' table. To convert an ''Element'' named ''ele'' to a child type (in this case, ''Document'') looks like `local doc = Element.As.Document(ele)`. No casting functionality is provided for other types.19 Lua has no classes, and casting from one type to another is important. Casting an ''Element'' to one of its child classes is provided through the ''Element.As'' table. To convert an ''Element'' named ''ele'' to a child type (in this case, ''Document'') looks like `local doc = Element.As.Document(ele)`. Any type whose name starts with ''Element'' (with the exception of ''Document'', which is short for ''ElementDocument'') will have a function in the ''Element.As'' table for casting. 20 20 21 21 The ''Log'' type/function is not defined in the ''rocket'' table like it is in Python. To print to the Log explicitly, you must call ''Log.Message''. The global Lua function 'print' has been adapted to output to the Log, and otherwise acts the same as the vanilla "print" function.