fix named ts object method calling
This commit is contained in:
BIN
BlockLua.dll
BIN
BlockLua.dll
Binary file not shown.
@@ -25,6 +25,7 @@ Lua scripting for Blockland
|
|||||||
`bl.varName` - Read a TorqueScript global variable
|
`bl.varName` - Read a TorqueScript global variable
|
||||||
`bl['varName']` - Read a TorqueScript global variable (i.e. with special characters in the name, or from an array)
|
`bl['varName']` - Read a TorqueScript global variable (i.e. with special characters in the name, or from an array)
|
||||||
`bl.set('varName', value)` - Write a TorqueScript global variable
|
`bl.set('varName', value)` - Write a TorqueScript global variable
|
||||||
|
`bl['namespaceName::funcName'](args)` - Call a namespaced TorqueScript function
|
||||||
|
|
||||||
### Accessing Torque Objects from Lua
|
### Accessing Torque Objects from Lua
|
||||||
`bl.objectName` - Access a Torque object by name
|
`bl.objectName` - Access a Torque object by name
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
// Private - Utilities used by libbl from the Lua side
|
// Private - Utilities used by libbl from the Lua side
|
||||||
|
|
||||||
package _bllua_smartEval {
|
package smartEval {
|
||||||
// Allow prepending ' to console commands to eval in lua instead of TS
|
// Allow prepending ' to console commands to eval in lua instead of TS
|
||||||
// Also wraps TS lines with echo(...); if they don't end in ; or }
|
// Also wraps TS lines with echo(...); if they don't end in ; or }
|
||||||
function ConsoleEntry::eval() {
|
function ConsoleEntry::eval() {
|
||||||
@@ -28,7 +28,7 @@ package _bllua_smartEval {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
activatePackage(_bllua_smartEval);
|
activatePackage(smartEval);
|
||||||
|
|
||||||
package _bllua_objectDeletionHook {
|
package _bllua_objectDeletionHook {
|
||||||
// Hook object deletion to clean up its lua data
|
// Hook object deletion to clean up its lua data
|
||||||
|
|||||||
@@ -303,7 +303,10 @@ local tsObjectMeta = {
|
|||||||
for inh in objectInheritedMetas(rawget(t,'_tsClassName')) do
|
for inh in objectInheritedMetas(rawget(t,'_tsClassName')) do
|
||||||
if inh[name] then return inh[name] end
|
if inh[name] then return inh[name] end
|
||||||
end
|
end
|
||||||
if tsIsFunctionNs(rawget(t,'_tsNamespace'), name) then
|
if
|
||||||
|
tsIsFunctionNs(rawget(t,'_tsNamespace'), name) or
|
||||||
|
tsIsFunctionNs(rawget(t,'_tsName'), name)
|
||||||
|
then
|
||||||
return function(t, ...)
|
return function(t, ...)
|
||||||
local args = {...}
|
local args = {...}
|
||||||
local argsS = arglistToTs(args)
|
local argsS = arglistToTs(args)
|
||||||
@@ -921,10 +924,12 @@ end
|
|||||||
-- bl.new and bl.datablock
|
-- bl.new and bl.datablock
|
||||||
local function createTsObj(keyword, class, name, inherit, props)
|
local function createTsObj(keyword, class, name, inherit, props)
|
||||||
local propsT = {}
|
local propsT = {}
|
||||||
for k,v in pairs(props) do
|
if props then
|
||||||
if not isValidFuncName(k) then
|
for k,v in pairs(props) do
|
||||||
error('bl.new/bl.datablock: invalid property name \''..k..'\'') end
|
if not isValidFuncName(k) then
|
||||||
table.insert(propsT, k..'="'..valToTs(v)..'";')
|
error('bl.new/bl.datablock: invalid property name \''..k..'\'') end
|
||||||
|
table.insert(propsT, k..'="'..valToTs(v)..'";')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local objS = _bllua_ts.eval(
|
local objS = _bllua_ts.eval(
|
||||||
|
|||||||
Reference in New Issue
Block a user