gopher-lua
gopher-lua copied to clipboard
bug
- [ ] GopherLua is a Lua5.1 implementation. You should be familiar with Lua programming language. Have you read Lua 5.1 reference manual carefully?
- [ ] GopherLua is a Lua5.1 implementation. In Lua, to keep it simple, it is more important to remove functionalities rather than to add functionalities unlike other languages . If you are going to introduce some new cool functionalities into the GopherLua code base and the functionalities can be implemented by existing APIs, It should be implemented as a library.
Please answer the following before submitting your issue:
- What version of GopherLua are you using? : 0.0.0
- What version of Go are you using? : 1.14.1
- What operating system and processor architecture are you using? :windows
- What did you do? : =====main.lua==== require "bug" bug.conver("main") ============== =====bug.lua===== module(..., package.seeall) function conver(str) str = f() and str or str print(type(str)) end function f() return false end ================
- What did you expect to see? : string
- What did you see instead? : boolean
function conver(str) str = f() and str or str print(type(str)) end function f() return false end conver("main")
I've found out that if you don't reassign to the "str" variable it works as expected. Like this:
function f()
return false
end
function conver(str)
str2 = f() and str or str
print(type(str2))
end
conver("main")
I guess there must be a bug in handling self-assigning expressions. Indeed weird!