File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed
Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 44 <a href="https://github.com/ReFreezed/LuaPreprocess/releases/latest">
55 <img src="https://img.shields.io/github/release/ReFreezed/LuaPreprocess.svg" alt="">
66 </a>
7- <a href="https://github.com/ReFreezed/LuaPreprocess/blob/master/LICENSE">
7+ <a href="https://github.com/ReFreezed/LuaPreprocess/blob/master/LICENSE.txt ">
88 <img src="https://img.shields.io/github/license/ReFreezed/LuaPreprocess.svg" alt="">
99 </a>
1010</p >
Original file line number Diff line number Diff line change @@ -1974,7 +1974,13 @@ function metaEnv.__MACRO()
19741974end
19751975
19761976function metaEnv .__EVALSYMBOL (v )
1977- if type (v ) == " function" then
1977+ if
1978+ type (v ) == " function"
1979+ -- We use debug.getmetatable instead of _G.getmetatable because we
1980+ -- don't want to potentially invoke used code right here - we just
1981+ -- want to know if the value is callable.
1982+ or (type (v ) == " table" and debug.getmetatable (v ) and debug.getmetatable (v ).__call )
1983+ then
19781984 v = v ()
19791985 end
19801986 return v
Original file line number Diff line number Diff line change @@ -167,10 +167,19 @@ other = 500921
167167!local RANDOM = "math.random()"
168168local rand = $RANDOM
169169
170- !local function EQUATION() return "x*3+y" end
170+ !local EQUATION_FROM_FUNCTION = (function()
171+ return "x*3+y"
172+ end)
173+ !local EQUATION_FROM_TABLE = setmetatable({}, {
174+ __call = function()
175+ return "z*-8"
176+ end,
177+ })
171178local x = 5
172179local y = 89
173- local z = $EQUATION
180+ local z = $EQUATION_FROM_FUNCTION
181+ local w = $EQUATION_FROM_TABLE
182+ print("w is "..w)
174183
175184
176185
Original file line number Diff line number Diff line change @@ -118,6 +118,8 @@ local rand = math.random()
118118local x = 5
119119local y = 89
120120local z = x * 3 + y
121+ local w = z *- 8
122+ print (" w is " .. w )
121123
122124
123125
You can’t perform that action at this time.
0 commit comments