-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why Lua tables aren't accepted as JS dictionaries? #44
Comments
See https://github.com/fengari-lua/fengari-interop#createproxyx-type
In JS, if you do Instead, the default conversion of lua objects to JS is more like a JS
I use such a function myself (https://gist.github.com/daurnimator/5a7fa933e96e14333962093322e0ff95/) e.g. here So far fengari-interop doesn't have any "helpers"; so this would be quite a new concept for the library. Though you're probably right that it would be useful... |
Is the default conversion of objects to JS is a |
no, the default is an object with methods |
I want to translate this JS one-liner to Lua:
This works, but is too bulky:
This looks nice, but doesn't work:
Why Fengari doesn't convert Lua tables to JS dictionaries on-the-fly?
It's too boring to write this conversion manually.
If there are some reasons why such conversion could not be done automatically,
please add a function
js.dict(lua_table)
which will convert Lua-curly-braces into JS-curly-braces.This function would make creating a JS dictionary on Lua side a lot easier:
Yes, I know that I can write such function myself on Lua side, but this function is a "must-have" for every developer.
The text was updated successfully, but these errors were encountered: