-
Notifications
You must be signed in to change notification settings - Fork 11
Rulesets for table-based function params #143
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0e2f4c1
WIP fluent list work.
Rider-Linden 7e4dad2
Add rulesets for generating table based way of passing parameters to …
Rider-Linden 1f65fff
Rework fluent in simple tables with unwrap when passed to the function
Rider-Linden 0aadd71
Adding media parameters and correct casing on methods.
Rider-Linden ee92d33
update generated files
Rider-Linden 07def94
Adding llSetMediaParams with white list exposed as array of strings.
Rider-Linden eb15da1
Update generated files
Rider-Linden 03f4903
Adding LLHTTPRequest with header and accept processing.
Rider-Linden cfb60b6
update for ruff check.
Rider-Linden c714e01
Apply suggestions from code review
Rider-Linden c7a7ae6
prepushing generated
Rider-Linden 8824092
fix for potential stack underflow
Rider-Linden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,3 +36,4 @@ stage/ | |
|
|
||
| # Editors | ||
| .vscode | ||
| *.code-workspace | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| // http-params | ||
| static const FluentParamDescriptor kHTTPRequestParamsDescs[] = { | ||
| {"method", 's', 0}, | ||
| {"mimetype", 's', 1}, | ||
| {"body_maxlength", 'i', 2}, | ||
| {"verify_cert", 'b', 3}, | ||
| {"verbose_throttle", 'b', 4}, | ||
| {"custom_header", 'M', 5}, | ||
| {"pragma_no_cache", 'b', 6}, | ||
| {"user_agent", 's', 7}, | ||
| {"accept", 'N', 8}, | ||
| {"extended_error", 'b', 9}, | ||
| }; | ||
| static FluentBuilderDef* kHTTPRequestParamsDef = fluent_builder_def_build(kHTTPRequestParamsDescs, std::size(kHTTPRequestParamsDescs)); | ||
| auto request = [](lua_State* L) -> int { | ||
| const auto* def = (const FluentBuilderDef*)lua_tolightuserdata(L, lua_upvalueindex(1)); | ||
| slua_fluent_serialize(L, 2, def); | ||
| int rules_idx = lua_gettop(L); | ||
| lua_rawgetfield(L, LUA_BASEGLOBALSINDEX, "ll"); | ||
| lua_rawgetfield(L, -1, "HTTPRequest"); | ||
| lua_pushvalue(L, 1); | ||
| lua_pushvalue(L, rules_idx); | ||
| if (lua_isnoneornil(L, 3)) lua_pushliteral(L, ""); else lua_pushvalue(L, 3); | ||
| lua_call(L, 3, 1); | ||
| return 1; | ||
| }; | ||
| slua_register_fluent_fn(L, "llhttp", "request", request, kHTTPRequestParamsDef); | ||
|
|
||
| // particle-params | ||
| static const FluentParamDescriptor kParticleParamsDescs[] = { | ||
| {"flags", 'i', 0}, | ||
| {"color_begin", 'v', 1}, | ||
| {"alpha_begin", 'f', 2}, | ||
| {"color_end", 'v', 3}, | ||
| {"alpha_end", 'f', 4}, | ||
| {"scale_begin", 'v', 5}, | ||
| {"scale_end", 'v', 6}, | ||
| {"part_max_age", 'f', 7}, | ||
| {"accel", 'v', 8}, | ||
| {"pattern", 'i', 9}, | ||
| {"angle_inner", 'f', 10}, | ||
| {"angle_outer", 'f', 11}, | ||
| {"texture", 'a', 12}, | ||
| {"burst_rate", 'f', 13}, | ||
| {"burst_count", 'i', 15}, | ||
| {"burst_radius", 'f', 16}, | ||
| {"burst_speed_min", 'f', 17}, | ||
| {"burst_speed_max", 'f', 18}, | ||
| {"src_max_age", 'f', 19}, | ||
| {"target_key", 'k', 20}, | ||
| {"omega", 'v', 21}, | ||
| {"angle_begin", 'f', 22}, | ||
| {"angle_end", 'f', 23}, | ||
| {"blend_func_source", 'i', 24}, | ||
| {"blend_func_dest", 'i', 25}, | ||
| {"glow_begin", 'f', 26}, | ||
| {"glow_end", 'f', 27}, | ||
| }; | ||
| static const FluentFlagDescriptor kParticleParamFlagDescs[] = { | ||
| {"color_interp", 0x1, 0}, | ||
| {"scale_interp", 0x2, 0}, | ||
| {"bounce", 0x4, 0}, | ||
| {"wind", 0x8, 0}, | ||
| {"follow", 0x10, 0}, | ||
| {"follow_velocity", 0x20, 0}, | ||
| {"target_pos", 0x40, 0}, | ||
| {"target_linear", 0x80, 0}, | ||
| {"emissive", 0x100, 0}, | ||
| {"ribbon", 0x400, 0}, | ||
| }; | ||
| static FluentBuilderDef* kParticleParamsDef = []() { | ||
| auto* d = fluent_builder_def_build(kParticleParamsDescs, std::size(kParticleParamsDescs)); | ||
| fluent_builder_def_add_flags(d, kParticleParamFlagDescs, std::size(kParticleParamFlagDescs)); | ||
| return d; | ||
| }(); | ||
| auto particle_system = [](lua_State* L) -> int { | ||
| const auto* def = (const FluentBuilderDef*)lua_tolightuserdata(L, lua_upvalueindex(1)); | ||
| int link = lua_isnoneornil(L, 2) ? SLUA_LINK_THIS : luaL_checkinteger(L, 2); | ||
| slua_fluent_serialize(L, 1, def); | ||
| int rules_idx = lua_gettop(L); | ||
| lua_rawgetfield(L, LUA_BASEGLOBALSINDEX, "ll"); | ||
| lua_rawgetfield(L, -1, "LinkParticleSystem"); | ||
| lua_pushinteger(L, link); | ||
| lua_pushvalue(L, rules_idx); | ||
| lua_call(L, 2, 0); | ||
| return 0; | ||
| }; | ||
| slua_register_fluent_fn(L, "llprim", "particleSystem", particle_system, kParticleParamsDef); | ||
|
|
||
| // prim-media-params | ||
| static const FluentParamDescriptor kPrimMediaParamsDescs[] = { | ||
| {"alt_image_enable", 'b', 0}, | ||
| {"controls", 'i', 1}, | ||
| {"current_url", 's', 2}, | ||
| {"home_url", 's', 3}, | ||
| {"auto_loop", 'b', 4}, | ||
| {"auto_play", 'b', 5}, | ||
| {"auto_scale", 'b', 6}, | ||
| {"auto_zoom", 'b', 7}, | ||
| {"first_click_interact", 'b', 8}, | ||
| {"width_pixels", 'i', 9}, | ||
| {"height_pixels", 'i', 10}, | ||
| {"whitelist_enable", 'b', 11}, | ||
| {"whitelist", 'C', 12}, | ||
| {"perms_interact", 'i', 13}, | ||
| {"perms_control", 'i', 14}, | ||
| }; | ||
| static FluentBuilderDef* kPrimMediaParamsDef = fluent_builder_def_build(kPrimMediaParamsDescs, std::size(kPrimMediaParamsDescs)); | ||
| auto set_media = [](lua_State* L) -> int { | ||
| const auto* def = (const FluentBuilderDef*)lua_tolightuserdata(L, lua_upvalueindex(1)); | ||
| int face = luaL_checkinteger(L, 1); | ||
| int link = lua_isnoneornil(L, 3) ? SLUA_LINK_THIS : luaL_checkinteger(L, 3); | ||
| slua_fluent_serialize(L, 2, def); | ||
| int rules_idx = lua_gettop(L); | ||
| lua_rawgetfield(L, LUA_BASEGLOBALSINDEX, "ll"); | ||
| lua_rawgetfield(L, -1, "SetLinkMedia"); | ||
| lua_pushinteger(L, link); | ||
| lua_pushinteger(L, face); | ||
| lua_pushvalue(L, rules_idx); | ||
| lua_call(L, 3, 1); | ||
| return 1; | ||
| }; | ||
| slua_register_fluent_fn(L, "llprim", "setMedia", set_media, kPrimMediaParamsDef); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if both flags and booleans are given, they are
ored together?