lua
lua copied to clipboard
could not compile - missing import
nim c -r examples/luaex.nim
could not import: lua_equal
Try --deadCodeElim:on
perhaps.
--deadCodeElim:on
resulted in
could not import: luaL_loadbuffer
Which lua do you have 5.1 or 5.2 On Feb 16, 2015 3:48 PM, "richard bucker" [email protected] wrote:
--deadCodeElim:on resulted in
could not import: luaL_loadbuffer
— Reply to this email directly or view it on GitHub https://github.com/nim-lang/lua/issues/2#issuecomment-74577584.
> lua -v
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
Use lua52 module
Old examples may not work depending on the API changes
lua52 generated this error:
/Users/richardbu/.nimble/pkgs/lua-1.0/lua52.nim(409, 29) Error: ')' expected
@rbucker likely a proc param named func
, it errors because func
is a keyword now.
sounds like it's a no go?
Change it and create a PR please.
I started working on the PR and then...
/Users/richardbu/.nimble/pkgs/lua-1.0/lua52.nim(634, 41) Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]
/Users/richardbu/.nimble/pkgs/lua-1.0/lua52.nim(658, 8) Warning: use File instead; TFile is deprecated [Deprecated]
/Users/richardbu/.nimble/pkgs/lua-1.0/lua52.nim(665, 45) Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]
/Users/richardbu/.nimble/pkgs/lua-1.0/lua52.nim(666, 32) Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]
/Users/richardbu/.nimble/pkgs/lua-1.0/lua52.nim(667, 22) Warning: 'l' should not be used as an identifier; may look like '1' (one) [SmallLshouldNotBeUsed]
/Users/richardbu/.nimble/pkgs/lua-1.0/lua52.nim(13, 2) Hint: 'LUA_RELEASE' is declared but not used [XDeclaredButNotUsed]
luaex.nim(13, 8) Error: undeclared identifier: 'loadbuffer'
I suppose I could fix the warnings, however, the error... not as much fun.
@rbucker some compatibility functions are in there, luaL_loadbuffer
, left as templates because it was tedious to figure out what types they should be, also some of them would conflict with functions defined. loadbuffer would look like this (see luaL_loadbuffer)
proc loadbuffer(L:PState; buff:cstring; sz:csize; name:cstring): cint =
loadbufferx(L, buff, sz, name, nil)
can you try compiling the module lua52 itself? there is a test included if you compile the module itself