Introducing LuaToFM, a free powerful plugin that seamlessly integrates Lua scripting into your FileMaker environment. With LuaToFM, you can unlock new possibilities for your FileMaker applications, enhancing functionality and performance.
lu_Evaluate ( "
function my_sum( a, ... )
local sum = a
for i, x in ipairs{...} do
sum = sum + x
end
return sum
end
" ) & ¶ &
lu_RegisterLuaFunction( "my_sum( a { ; ... } )" ; "my sum lua function" )
lu_my_sum( 2 ; 3 ; 4 )
// returns
// 9
lu_Evaluate ( "
a=2
" ) & ¶ &
lu_Get ( "a" )
// returns
// 2
lu_SetToState ( "a = 10" ; "0x15a6eb608" ) & ¶ &
lu_GetFromState ( "a" ; "0x15a6eb608" )
// returns
// 10
lu_Evaluate ( "
tbl = {
a = 1,
b = 'smth text',
c = { 1, 2, 3 , 4 },
d = {
e = { 'aa', 'bb', 'cc' },
f = { 1, 'dddd' , 3 }
}
}
"
) & ¶ &
lu_Get ( "tbl" )
// returns:
// {"c":[1,2,3,4],"b":"smth text","a":1,"d":{"e":["aa","bb","cc"],"f":[1,"dddd",3]}}
lu_Evaluate ( "
cnt, res = LuaToFM.executeFMSQL ( {
file = 'Ltest',
query = 'SELECT id, test_text FROM LTest WHERE id > ? AND id < ? ',
params = { 17, 21 }
})
" )
lu_Evaluate ( "
http = require('socket.http')
h = http.request('https://odonata.tech')
" )