Hi,
I made a cheat sheet for LoG scripting:
https://sites.google.com/site/jkosgrimr ... heat-sheet
I think it could be useful to someone else too.
Code: Select all
"a".."b" == "ab"
"a"..0 == "a0"
Code: Select all
multiLineString = [[
Hello
Grimrock!
]]
multiLineString = "Hello\nGrimrock!"
Code: Select all
table1 = {'a','b','c'}
table1[1] == "a"
table2 = {key1='value1'}
table2.key1 == 'value1'
Code: Select all
property = "a"
function getProperty()
return property
end
function setProperty(value)
property = value
end
entity_id.getProperty() == "a"
entity_id.setProperty('c') (ok)
entity_id:getProperty() == "c"
entity_id:setProperty('c') (error)
Code: Select all
local obj = {}
obj.property = "a"
obj.method = function(self)
return self.property
end
obj:method() == "a"
obj:method() == obj.method(obj)
obj.method() (error)
Code: Select all
-- magic self
local obj2 = {}
obj2.property = 'b'
function obj2:method()
return self.property
end
obj:method() == 'b'
obj.method() (error)
Code: Select all
variable = snail_1 (serialization error on save game)
variable = snail_1.id (ok)
local variable = snail_1 (ok)
Code: Select all
function breakTheGame()
undefinedGlobal = 'crash'
end
Code: Select all
myMethods = {}
function breakTheGame()
local upvalue = "causes serialization error"
myMethods.useExternalLocalVariable = function()
print(upvalue)
end
end
breakTheGame()