Skip to content

Commit e29ca01

Browse files
committed
Bind printt as Lua's print function
1 parent 0eca30d commit e29ca01

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This plugin is available in the Asset Library as [Lua GDExtension](https://godot
1818
+ Create and manipulate Variant values
1919
+ Instantiate objects and access class constants
2020
+ Access singleton objects by name
21-
+ Utility classes, like `print`, `lerp` and `is_same`
21+
+ Utility functions, like `print_rich`, `lerp` and `is_same`
2222
+ Global enums, like `OK`, `TYPE_STRING` and `SIDE_LEFT`
2323
+ (TODO) Patch Lua `package.searchers` to accept paths relative to `res://` and `user://`
2424
- Create Godot scripts directly in Lua

src/generate_code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"float",
1111
]
1212
UTILITY_FUNCTION_MAP = {
13+
"print": None,
1314
"typeof": None,
1415
"is_instance_valid": None,
1516
}

src/luaopen/utility_functions.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ extern "C" int luaopen_godot_utility_functions(lua_State *L) {
3737

3838
register_utility_functions(state);
3939

40+
// In Lua, `print` separates passed values with "\t", so we bind it to Godot's `printt`
41+
state.do_string("print = printt");
42+
4043
return 0;
4144
}
4245

0 commit comments

Comments
 (0)