summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSteven <burnett@posteo.de>2026-01-25 23:49:55 +0000
committerSteven <burnett@posteo.de>2026-01-25 23:49:55 +0000
commit9d0b18336f45c3e51b0f9251a49a74ae9a9f7b63 (patch)
treeadf327789e2d33c4e9a68858b4e6bbcc0b30baba /examples
parent80d90562daedb0fda275aeb04809fd22060a196a (diff)
fix(examples): lua use let
Diffstat (limited to 'examples')
-rw-r--r--examples/scripting/lua/lua.zc10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/scripting/lua/lua.zc b/examples/scripting/lua/lua.zc
index a8463fa..ebd3ae6 100644
--- a/examples/scripting/lua/lua.zc
+++ b/examples/scripting/lua/lua.zc
@@ -8,7 +8,7 @@ import "lauxlib.h";
import "lualib.h";
fn l_zenc_hello(L: lua_State*) -> int {
- const name: string = (string)luaL_optstring(L, 1, "world");
+ let name: string = (string)luaL_optstring(L, 1, "world");
println "hello from Zen-C, {name}"
return 0;
}
@@ -27,21 +27,21 @@ fn main() {
lua_setglobal(L, "zenc_hello");
// Run some Lua from a Zen-C variable
- const script = "print('hello from lua')\nzenc_hello('test')\n";
+ let script = "print('hello from lua')\nzenc_hello('test')\n";
if (luaL_dostring(L, script) != LUA_OK) {
- const err: string = (string)lua_tostring(L, -1);
+ let err: string = (string)lua_tostring(L, -1);
!"lua error: {err}"
lua_pop(L, 1);
}
// Run some Lua from a script file
if (luaL_loadfile(L, "script.lua") != LUA_OK) {
- const err: string = (string)lua_tostring(L, -1);
+ let err: string = (string)lua_tostring(L, -1);
!"lua load-error: {err}"
lua_pop(L, 1);
} else if (lua_pcall(L, 0, 0, 0) != LUA_OK) {
- const err: string = (string)lua_tostring(L, -1);
+ let err: string = (string)lua_tostring(L, -1);
!"lua error: {err}"
lua_pop(L, 1);
}