[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Syntax checking Lua scripts
- From: Rob Kendrick <lua-l@...>
- Date: Tue, 01 May 2007 19:29:00 +0100
Jason Murdick wrote:
> Well, I have script_A. And then I have function_A and function_B that
> are written in C++ and exposed to the lua stack.
>
> If I try to use a standard lua syntax checker it reports function_A
> and function_B as being syntax errors because they aren't registered I
> guess in the global space. However, if I run the script from within
> my application it works fine.
I expect this to happen if you try to *run* your scripts. Try just
compiling them, with luac or similar. This doesn't produce errors:
5 rjek@trite:~ $ cat test.lua
function_A(1, 2, 3)
function_B(4, 5, 6)
6 rjek@trite:~ $ luac -l test.lua
main <test.lua:0,0> (11 instructions, 44 bytes at 0x61a530)
0+ params, 4 slots, 0 upvalues, 0 locals, 8 constants, 0 functions
1 [1] GETGLOBAL 0 -1 ; function_A
2 [1] LOADK 1 -2 ; 1
3 [1] LOADK 2 -3 ; 2
4 [1] LOADK 3 -4 ; 3
5 [1] CALL 0 4 1
6 [2] GETGLOBAL 0 -5 ; function_B
7 [2] LOADK 1 -6 ; 4
8 [2] LOADK 2 -7 ; 5
9 [2] LOADK 3 -8 ; 6
10 [2] CALL 0 4 1
11 [2] RETURN 0 1
7 rjek@trite:~ $
The script compiles without issue. How are you "syntax checking" your
scripts?
B.