lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The Lua Interpreter was compiled with MadOS. 
I change the "main" in lua.c to "lua", and startup it as a thread.
I do some test like filesystem、network、..., It seems running fine.
* I running the Lua source code on the STM32.
* Nothing changed
* I define " function mypow(x,y) return x^y end " but got an error " stdin:1: 'end' expected near '<\25>' ".
* It looks same.

Joseph C. Sible <josephcsible@gmail.com> 于2020年7月5日周日 上午5:43写道:
On Sat, Jul 4, 2020 at 3:01 PM Long Z <zandzx02cn@gmail.com> wrote:
>
> HW: STM32F107RCT6 (ARM Cortex M3)
> OS: MadOS
> I port lua to a RTOS, and then found a strange error :
> * math.pow(2, 2) result 4.0 BUT 2^2 result 2.
> * After some test, I found x^y result x always.
> * I used v5.4.0, v5.3.5 and v5.1.5 for testing, and got the same result.
> Here is my luaconfig.h used in v5.4.0.
>

Here's some troubleshooting ideas/questions:

* Are you running the Lua source code on the STM32, or are you
compiling it somewhere else and just running the bytecode there? If
the latter, does the former work any better?
* If you stub out the whole constfolding function in src/lcode.c,
replacing the entire body with "return 0;", does anything change?
* If you do "function mypow(x, y) return x ^ y end" and then call
"mypow(2, 2)", what does it return?
* If you get the numbers at runtime instead of hardcoding them in the
Lua source, does anything change?

Joseph C. Sible


--
龙的传人