diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-03-30 21:59:30 +0200 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-03-30 22:17:54 +0200 |
commit | 327b12d488a7f001e21826a5b9e1df03af44c7ae (patch) | |
tree | 26f3ef2759c2f7764bbe0f21a7df5f1735f4f9ae /advtrains/advtrains_luaautomation/init.lua | |
parent | 606c129f5796eb56e9abd1049954cf1ca0b8f410 (diff) | |
download | advtrains-327b12d488a7f001e21826a5b9e1df03af44c7ae.tar.gz advtrains-327b12d488a7f001e21826a5b9e1df03af44c7ae.tar.bz2 advtrains-327b12d488a7f001e21826a5b9e1df03af44c7ae.zip |
Assert some variable types obtained from lua automation
Diffstat (limited to 'advtrains/advtrains_luaautomation/init.lua')
-rw-r--r-- | advtrains/advtrains_luaautomation/init.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/advtrains/advtrains_luaautomation/init.lua b/advtrains/advtrains_luaautomation/init.lua index 87f5921..71808e7 100644 --- a/advtrains/advtrains_luaautomation/init.lua +++ b/advtrains/advtrains_luaautomation/init.lua @@ -16,6 +16,13 @@ atlatc = { envs = {}} minetest.register_privilege("atlatc", { description = "Player can place and modify LUA ATC components. Grant with care! Allows to execute bad LUA code.", give_to_singleplayer = false, default= false }) +--assertt helper. error if a variable is not of a type +function assertt(var, typ) + if type(var)~=typ then + error("Assertion failed, variable has to be of type "..typ) + end +end + local mp=minetest.get_modpath("advtrains_luaautomation") if not mp then error("Mod name error: Mod folder is not named 'advtrains_luaautomation'!") |